EcsFargateContainerDefinition
- class aws_cdk.aws_batch.EcsFargateContainerDefinition(scope, id, *, assign_public_ip=None, ephemeral_storage_size=None, fargate_cpu_architecture=None, fargate_operating_system_family=None, fargate_platform_version=None, cpu, image, memory, command=None, enable_execute_command=None, environment=None, execution_role=None, job_role=None, linux_parameters=None, logging=None, readonly_root_filesystem=None, secrets=None, user=None, volumes=None)
- Bases: - Construct- A container orchestrated by ECS that uses Fargate resources. - ExampleMetadata:
- infused 
 - Example: - job_defn = batch.EcsJobDefinition(self, "JobDefn", container=batch.EcsFargateContainerDefinition(self, "myFargateContainer", image=ecs.ContainerImage.from_registry("public.ecr.aws/amazonlinux/amazonlinux:latest"), memory=cdk.Size.mebibytes(2048), cpu=256, ephemeral_storage_size=cdk.Size.gibibytes(100), fargate_cpu_architecture=ecs.CpuArchitecture.ARM64, fargate_operating_system_family=ecs.OperatingSystemFamily.LINUX ) ) - Parameters:
- scope ( - Construct)
- id ( - str)
- assign_public_ip ( - Optional[- bool]) – Indicates whether the job has a public IP address. For a job that’s running on Fargate resources in a private subnet to send outbound traffic to the internet (for example, to pull container images), the private subnet requires a NAT gateway be attached to route requests to the internet. Default: false
- ephemeral_storage_size ( - Optional[- Size]) – The size for ephemeral storage. Default: - 20 GiB
- fargate_cpu_architecture ( - Optional[- CpuArchitecture]) – The vCPU architecture of Fargate Runtime. Default: - X86_64
- fargate_operating_system_family ( - Optional[- OperatingSystemFamily]) – The operating system for the compute environment. Default: - LINUX
- fargate_platform_version ( - Optional[- FargatePlatformVersion]) – Which version of Fargate to use when running this container. Default: LATEST
- cpu ( - Union[- int,- float]) – The number of vCPUs reserved for the container. Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.
- image ( - ContainerImage) – The image that this container will run.
- memory ( - Size) – The memory hard limit present to the container. If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.
- command ( - Optional[- Sequence[- str]]) – The command that’s passed to the container. Default: - no command
- enable_execute_command ( - Optional[- bool]) – Determines whether execute command functionality is turned on for this task. If true, execute command functionality is turned on all the containers in the task. This allows you to use ECS Exec to access containers interactively. When enabled, a job role with required SSM permissions will be created automatically if no job role is provided. If a job role is alreadyprovided, the required permissions will be added to it. Default: undefined - AWS Batch default is false
- environment ( - Optional[- Mapping[- str,- str]]) – The environment variables to pass to a container. Cannot start with- AWS_BATCH. We don’t recommend using plaintext environment variables for sensitive information, such as credential data. Default: - no environment variables
- execution_role ( - Optional[- IRole]) – The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf. Default: - a Role will be created
- job_role ( - Optional[- IRole]) – The role that the container can assume. Default: - no job role
- linux_parameters ( - Optional[- LinuxParameters]) – Linux-specific modifications that are applied to the container, such as details for device mappings. Default: none
- logging ( - Optional[- LogDriver]) – The loging configuration for this Job. Default: - the log configuration of the Docker daemon
- readonly_root_filesystem ( - Optional[- bool]) – Gives the container readonly access to its root filesystem. Default: false
- secrets ( - Optional[- Mapping[- str,- Secret]]) – A map from environment variable names to the secrets for the container. Allows your job definitions to reference the secret by the environment variable name defined in this property. Default: - no secrets
- user ( - Optional[- str]) – The user name to use inside the container. Default: - no user
- volumes ( - Optional[- Sequence[- EcsVolume]]) – The volumes to mount to this container. Automatically added to the job definition. Default: - no volumes
 
 - Methods - add_volume(volume)
- Add a Volume to this container. - Parameters:
- volume ( - EcsVolume)
- Return type:
- None
 
 - to_string()
- Returns a string representation of this construct. - Return type:
- str
 
 - Attributes - PROPERTY_INJECTION_ID = 'aws-cdk-lib.aws-batch.EcsFargateContainerDefinition'
 - assign_public_ip
- Indicates whether the job has a public IP address. - For a job that’s running on Fargate resources in a private subnet to send outbound traffic to the internet (for example, to pull container images), the private subnet requires a NAT gateway be attached to route requests to the internet. 
 - command
- The command that’s passed to the container. 
 - cpu
- The number of vCPUs reserved for the container. - Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU. 
 - enable_execute_command
- Whether to enable ecs exec for this container. 
 - environment
- The environment variables to pass to a container. - Cannot start with - AWS_BATCH. We don’t recommend using plaintext environment variables for sensitive information, such as credential data.
 - ephemeral_storage_size
- The size for ephemeral storage. 
 - execution_role
- The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf. 
 - fargate_cpu_architecture
- The vCPU architecture of Fargate Runtime. 
 - fargate_operating_system_family
- The operating system for the compute environment. 
 - fargate_platform_version
- Which version of Fargate to use when running this container. 
 - image
- The image that this container will run. 
 - job_role
- The role that the container can assume. 
 - linux_parameters
- Linux-specific modifications that are applied to the container, such as details for device mappings. 
 - log_driver_config
- The configuration of the log driver. 
 - memory
- The memory hard limit present to the container. - If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job. 
 - node
- The tree node. 
 - readonly_root_filesystem
- Gives the container readonly access to its root filesystem. 
 - secrets
- A map from environment variable names to the secrets for the container. - Allows your job definitions to reference the secret by the environment variable name defined in this property. 
 - user
- The user name to use inside the container. 
 - volumes
- The volumes to mount to this container. - Automatically added to the job definition. 
 - Static Methods - classmethod is_construct(x)
- Checks if - xis a construct.- Use this method instead of - instanceofto properly detect- Constructinstances, even when the construct library is symlinked.- Explanation: in JavaScript, multiple copies of the - constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the class- Constructin each copy of the- constructslibrary is seen as a different class, and an instance of one class will not test as- instanceofthe other class.- npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the- constructslibrary can be accidentally installed, and- instanceofwill behave unpredictably. It is safest to avoid using- instanceof, and using this type-testing method instead.- Parameters:
- x ( - Any) – Any object.
- Return type:
- bool
- Returns:
- true if - xis an object created from a class which extends- Construct.