interface EcsContainerDefinitionProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Batch.EcsContainerDefinitionProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsbatch#EcsContainerDefinitionProps |
![]() | software.amazon.awscdk.services.batch.EcsContainerDefinitionProps |
![]() | aws_cdk.aws_batch.EcsContainerDefinitionProps |
![]() | aws-cdk-lib » aws_batch » EcsContainerDefinitionProps |
Props to configure an EcsContainerDefinition.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_batch as batch } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
declare const containerImage: ecs.ContainerImage;
declare const ecsVolume: batch.EcsVolume;
declare const linuxParameters: batch.LinuxParameters;
declare const logDriver: ecs.LogDriver;
declare const role: iam.Role;
declare const secret: batch.Secret;
declare const size: cdk.Size;
const ecsContainerDefinitionProps: batch.EcsContainerDefinitionProps = {
cpu: 123,
image: containerImage,
memory: size,
// the properties below are optional
command: ['command'],
environment: {
environmentKey: 'environment',
},
executionRole: role,
jobRole: role,
linuxParameters: linuxParameters,
logging: logDriver,
readonlyRootFilesystem: false,
secrets: {
secretsKey: secret,
},
user: 'user',
volumes: [ecsVolume],
};
Properties
Name | Type | Description |
---|---|---|
cpu | number | The number of vCPUs reserved for the container. |
image | Container | The image that this container will run. |
memory | Size | The memory hard limit present to the container. |
command? | string[] | The command that's passed to the container. |
environment? | { [string]: string } | The environment variables to pass to a container. |
execution | IRole | The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf. |
job | IRole | The role that the container can assume. |
linux | Linux | Linux-specific modifications that are applied to the container, such as details for device mappings. |
logging? | Log | The loging configuration for this Job. |
readonly | boolean | Gives the container readonly access to its root filesystem. |
secrets? | { [string]: Secret } | A map from environment variable names to the secrets for the container. |
user? | string | The user name to use inside the container. |
volumes? | Ecs [] | The volumes to mount to this container. |
cpu
Type:
number
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
Type:
Container
The image that this container will run.
memory
Type:
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?
Type:
string[]
(optional, default: no command)
The command that's passed to the container.
See also: https://docs.docker.com/engine/reference/builder/#cmd
environment?
Type:
{ [string]: string }
(optional, default: no environment variables)
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.
executionRole?
Type:
IRole
(optional, default: a Role will be created)
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
See also: https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html
jobRole?
Type:
IRole
(optional, default: no job role)
The role that the container can assume.
See also: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html
linuxParameters?
Type:
Linux
(optional, default: none)
Linux-specific modifications that are applied to the container, such as details for device mappings.
logging?
Type:
Log
(optional, default: the log configuration of the Docker daemon)
The loging configuration for this Job.
readonlyRootFilesystem?
Type:
boolean
(optional, default: false)
Gives the container readonly access to its root filesystem.
secrets?
Type:
{ [string]:
Secret
}
(optional, default: no 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?
Type:
string
(optional, default: no user)
The user name to use inside the container.
volumes?
Type:
Ecs
[]
(optional, default: no volumes)
The volumes to mount to this container.
Automatically added to the job definition.