Interface EcsContainerDefinitionProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
EcsEc2ContainerDefinitionProps, EcsFargateContainerDefinitionProps
All Known Implementing Classes:
EcsContainerDefinitionProps.Jsii$Proxy, EcsEc2ContainerDefinitionProps.Jsii$Proxy, EcsFargateContainerDefinitionProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:57.673Z") @Stability(Stable) public interface EcsContainerDefinitionProps extends software.amazon.jsii.JsiiSerializable
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 software.amazon.awscdk.*;
 import software.amazon.awscdk.services.batch.*;
 import software.amazon.awscdk.services.ecs.*;
 import software.amazon.awscdk.services.iam.*;
 ContainerImage containerImage;
 EcsVolume ecsVolume;
 LinuxParameters linuxParameters;
 LogDriver logDriver;
 Role role;
 Secret secret;
 Size size;
 EcsContainerDefinitionProps ecsContainerDefinitionProps = EcsContainerDefinitionProps.builder()
         .cpu(123)
         .image(containerImage)
         .memory(size)
         // the properties below are optional
         .command(List.of("command"))
         .environment(Map.of(
                 "environmentKey", "environment"))
         .executionRole(role)
         .jobRole(role)
         .linuxParameters(linuxParameters)
         .logging(logDriver)
         .readonlyRootFilesystem(false)
         .secrets(Map.of(
                 "secretsKey", secret))
         .user("user")
         .volumes(List.of(ecsVolume))
         .build();
 
  • Method Details

    • getCpu

      @Stability(Stable) @NotNull Number getCpu()
      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.

    • getImage

      @Stability(Stable) @NotNull ContainerImage getImage()
      The image that this container will run.
    • getMemory

      @Stability(Stable) @NotNull Size getMemory()
      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.

    • getCommand

      @Stability(Stable) @Nullable default List<String> getCommand()
      The command that's passed to the container.

      Default: - no command

      See Also:
    • getEnvironment

      @Stability(Stable) @Nullable default Map<String,String> getEnvironment()
      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

    • getExecutionRole

      @Stability(Stable) @Nullable default IRole getExecutionRole()
      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

      See Also:
    • getJobRole

      @Stability(Stable) @Nullable default IRole getJobRole()
      The role that the container can assume.

      Default: - no job role

      See Also:
    • getLinuxParameters

      @Stability(Stable) @Nullable default LinuxParameters getLinuxParameters()
      Linux-specific modifications that are applied to the container, such as details for device mappings.

      Default: none

    • getLogging

      @Stability(Stable) @Nullable default LogDriver getLogging()
      The loging configuration for this Job.

      Default: - the log configuration of the Docker daemon

    • getReadonlyRootFilesystem

      @Stability(Stable) @Nullable default Boolean getReadonlyRootFilesystem()
      Gives the container readonly access to its root filesystem.

      Default: false

    • getSecrets

      @Stability(Stable) @Nullable default Map<String,Secret> getSecrets()
      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

      See Also:
    • getUser

      @Stability(Stable) @Nullable default String getUser()
      The user name to use inside the container.

      Default: - no user

    • getVolumes

      @Stability(Stable) @Nullable default List<EcsVolume> getVolumes()
      The volumes to mount to this container.

      Automatically added to the job definition.

      Default: - no volumes

    • builder

      @Stability(Stable) static EcsContainerDefinitionProps.Builder builder()
      Returns:
      a EcsContainerDefinitionProps.Builder of EcsContainerDefinitionProps