CfnJobDefinition
- class aws_cdk.aws_batch.CfnJobDefinition(scope, id, *, type, container_properties=None, eks_properties=None, job_definition_name=None, node_properties=None, parameters=None, platform_capabilities=None, propagate_tags=None, retry_strategy=None, scheduling_priority=None, tags=None, timeout=None)
Bases:
CfnResource
A CloudFormation
AWS::Batch::JobDefinition
.The
AWS::Batch::JobDefinition
resource specifies the parameters for an AWS Batch job definition. For more information, see Job Definitions in the ** .- CloudformationResource:
AWS::Batch::JobDefinition
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # labels: Any # limits: Any # options: Any # parameters: Any # requests: Any # tags: Any cfn_job_definition = batch.CfnJobDefinition(self, "MyCfnJobDefinition", type="type", # the properties below are optional container_properties=batch.CfnJobDefinition.ContainerPropertiesProperty( image="image", # the properties below are optional command=["command"], environment=[batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )], ephemeral_storage=batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 ), execution_role_arn="executionRoleArn", fargate_platform_configuration=batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" ), instance_type="instanceType", job_role_arn="jobRoleArn", linux_parameters=batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] ), log_configuration=batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] ), memory=123, mount_points=[batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )], network_configuration=batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" ), privileged=False, readonly_root_filesystem=False, resource_requirements=[batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )], secrets=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )], ulimits=[batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )], user="user", vcpus=123, volumes=[batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )] ), eks_properties=batch.CfnJobDefinition.EksPropertiesProperty( pod_properties=batch.CfnJobDefinition.PodPropertiesProperty( containers=[batch.CfnJobDefinition.EksContainerProperty( image="image", # the properties below are optional args=["args"], command=["command"], env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty( name="name", # the properties below are optional value="value" )], image_pull_policy="imagePullPolicy", name="name", resources=batch.CfnJobDefinition.ResourcesProperty( limits=limits, requests=requests ), security_context=batch.CfnJobDefinition.SecurityContextProperty( privileged=False, read_only_root_filesystem=False, run_as_group=123, run_as_non_root=False, run_as_user=123 ), volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty( mount_path="mountPath", name="name", read_only=False )] )], dns_policy="dnsPolicy", host_network=False, metadata=batch.CfnJobDefinition.MetadataProperty( labels=labels ), service_account_name="serviceAccountName", volumes=[batch.CfnJobDefinition.EksVolumeProperty( name="name", # the properties below are optional empty_dir=batch.CfnJobDefinition.EmptyDirProperty( medium="medium", size_limit="sizeLimit" ), host_path=batch.CfnJobDefinition.HostPathProperty( path="path" ), secret=batch.CfnJobDefinition.EksSecretProperty( secret_name="secretName", # the properties below are optional optional=False ) )] ) ), job_definition_name="jobDefinitionName", node_properties=batch.CfnJobDefinition.NodePropertiesProperty( main_node=123, node_range_properties=[batch.CfnJobDefinition.NodeRangePropertyProperty( target_nodes="targetNodes", # the properties below are optional container=batch.CfnJobDefinition.ContainerPropertiesProperty( image="image", # the properties below are optional command=["command"], environment=[batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )], ephemeral_storage=batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 ), execution_role_arn="executionRoleArn", fargate_platform_configuration=batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" ), instance_type="instanceType", job_role_arn="jobRoleArn", linux_parameters=batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] ), log_configuration=batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] ), memory=123, mount_points=[batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )], network_configuration=batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" ), privileged=False, readonly_root_filesystem=False, resource_requirements=[batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )], secrets=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )], ulimits=[batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )], user="user", vcpus=123, volumes=[batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )] ) )], num_nodes=123 ), parameters=parameters, platform_capabilities=["platformCapabilities"], propagate_tags=False, retry_strategy=batch.CfnJobDefinition.RetryStrategyProperty( attempts=123, evaluate_on_exit=[batch.CfnJobDefinition.EvaluateOnExitProperty( action="action", # the properties below are optional on_exit_code="onExitCode", on_reason="onReason", on_status_reason="onStatusReason" )] ), scheduling_priority=123, tags=tags, timeout=batch.CfnJobDefinition.TimeoutProperty( attempt_duration_seconds=123 ) )
Create a new
AWS::Batch::JobDefinition
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
type (
str
) – The type of job definition. For more information about multi-node parallel jobs, see Creating a multi-node parallel job definition in the AWS Batch User Guide . .. epigraph:: If the job is run on Fargate resources, thenmultinode
isn’t supported.container_properties (
Union
[IResolvable
,ContainerPropertiesProperty
,Dict
[str
,Any
],None
]) – An object with various properties specific to Amazon ECS based jobs. Valid values arecontainerProperties
,eksProperties
, andnodeProperties
. Only one can be specified.eks_properties (
Union
[IResolvable
,EksPropertiesProperty
,Dict
[str
,Any
],None
]) – An object with various properties that are specific to Amazon EKS based jobs. Valid values arecontainerProperties
,eksProperties
, andnodeProperties
. Only one can be specified.job_definition_name (
Optional
[str
]) – The name of the job definition.node_properties (
Union
[IResolvable
,NodePropertiesProperty
,Dict
[str
,Any
],None
]) – An object with various properties that are specific to multi-node parallel jobs. Valid values arecontainerProperties
,eksProperties
, andnodeProperties
. Only one can be specified. .. epigraph:: If the job runs on Fargate resources, don’t specifynodeProperties
. UsecontainerProperties
instead.parameters (
Optional
[Any
]) – Default parameters or parameter substitution placeholders that are set in the job definition. Parameters are specified as a key-value pair mapping. Parameters in aSubmitJob
request override any corresponding parameter defaults from the job definition. For more information about specifying parameters, see Job definition parameters in the AWS Batch User Guide .platform_capabilities (
Optional
[Sequence
[str
]]) – The platform capabilities required by the job definition. If no value is specified, it defaults toEC2
. Jobs run on Fargate resources specifyFARGATE
.propagate_tags (
Union
[bool
,IResolvable
,None
]) – Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS task. If no value is specified, the tags aren’t propagated. Tags can only be propagated to the tasks when the tasks are created. For tags with the same name, job tags are given priority over job definitions tags. If the total number of combined tags from the job and job definition is over 50, the job is moved to theFAILED
state.retry_strategy (
Union
[IResolvable
,RetryStrategyProperty
,Dict
[str
,Any
],None
]) – The retry strategy to use for failed jobs that are submitted with this job definition.scheduling_priority (
Union
[int
,float
,None
]) – The scheduling priority of the job definition. This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.tags (
Optional
[Any
]) – The tags that are applied to the job definition.timeout (
Union
[IResolvable
,TimeoutProperty
,Dict
[str
,Any
],None
]) – The timeout time for jobs that are submitted with this job definition. After the amount of time you specify passes, AWS Batch terminates your jobs if they aren’t finished.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::Batch::JobDefinition'
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- container_properties
An object with various properties specific to Amazon ECS based jobs.
Valid values are
containerProperties
,eksProperties
, andnodeProperties
. Only one can be specified.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- eks_properties
An object with various properties that are specific to Amazon EKS based jobs.
Valid values are
containerProperties
,eksProperties
, andnodeProperties
. Only one can be specified.
- job_definition_name
The name of the job definition.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- node_properties
An object with various properties that are specific to multi-node parallel jobs.
Valid values are
containerProperties
,eksProperties
, andnodeProperties
. Only one can be specified. .. epigraph:If the job runs on Fargate resources, don't specify ``nodeProperties`` . Use ``containerProperties`` instead.
- parameters
Default parameters or parameter substitution placeholders that are set in the job definition.
Parameters are specified as a key-value pair mapping. Parameters in a
SubmitJob
request override any corresponding parameter defaults from the job definition. For more information about specifying parameters, see Job definition parameters in the AWS Batch User Guide .
- platform_capabilities
The platform capabilities required by the job definition.
If no value is specified, it defaults to
EC2
. Jobs run on Fargate resources specifyFARGATE
.
- propagate_tags
Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS task.
If no value is specified, the tags aren’t propagated. Tags can only be propagated to the tasks when the tasks are created. For tags with the same name, job tags are given priority over job definitions tags. If the total number of combined tags from the job and job definition is over 50, the job is moved to the
FAILED
state.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- retry_strategy
The retry strategy to use for failed jobs that are submitted with this job definition.
- scheduling_priority
The scheduling priority of the job definition.
This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
The tags that are applied to the job definition.
- timeout
The timeout time for jobs that are submitted with this job definition.
After the amount of time you specify passes, AWS Batch terminates your jobs if they aren’t finished.
- type
The type of job definition.
For more information about multi-node parallel jobs, see Creating a multi-node parallel job definition in the AWS Batch User Guide . .. epigraph:
If the job is run on Fargate resources, then ``multinode`` isn't supported.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
ContainerPropertiesProperty
- class CfnJobDefinition.ContainerPropertiesProperty(*, image, command=None, environment=None, ephemeral_storage=None, execution_role_arn=None, fargate_platform_configuration=None, instance_type=None, job_role_arn=None, linux_parameters=None, log_configuration=None, memory=None, mount_points=None, network_configuration=None, privileged=None, readonly_root_filesystem=None, resource_requirements=None, secrets=None, ulimits=None, user=None, vcpus=None, volumes=None)
Bases:
object
Container properties are used for Amazon ECS based job definitions.
These properties to describe the container that’s launched as part of a job.
- Parameters:
image (
str
) – The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with*repository-url* / *image* : *tag*
. It can be 255 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), underscores (_), colons (:), periods (.), forward slashes (/), and number signs (#). This parameter maps toImage
in the Create a container section of the Docker Remote API and theIMAGE
parameter of docker run . .. epigraph:: Docker image architecture must match the processor architecture of the compute resources that they’re scheduled on. For example, ARM-based Docker images can only run on ARM-based compute resources. - Images in Amazon ECR Public repositories use the fullregistry/repository[:tag]
orregistry/repository[@digest]
naming conventions. For example,public.ecr.aws/ *registry_alias* / *my-web-app* : *latest*
. - Images in Amazon ECR repositories use the full registry and repository URI (for example,123456789012.dkr.ecr.<region-name>.amazonaws.com/<repository-name>
). - Images in official repositories on Docker Hub use a single name (for example,ubuntu
ormongo
). - Images in other repositories on Docker Hub are qualified with an organization name (for example,amazon/amazon-ecs-agent
). - Images in other online repositories are qualified further by a domain name (for example,quay.io/assemblyline/ubuntu
).command (
Optional
[Sequence
[str
]]) –The command that’s passed to the container. This parameter maps to
Cmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#cmd .environment (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EnvironmentProperty
,Dict
[str
,Any
]]],None
]) –The environment variables to pass to a container. This parameter maps to
Env
in the Create a container section of the Docker Remote API and the--env
option to docker run . .. epigraph:: We don’t recommend using plaintext environment variables for sensitive information, such as credential data. > Environment variables cannot start with “AWS_BATCH
“. This naming convention is reserved for variables that AWS Batch sets.ephemeral_storage (
Union
[IResolvable
,EphemeralStorageProperty
,Dict
[str
,Any
],None
]) –CfnJobDefinition.ContainerPropertiesProperty.EphemeralStorage
.execution_role_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume. For jobs that run on Fargate resources, you must provide an execution role. For more information, see AWS Batch execution IAM role in the AWS Batch User Guide .fargate_platform_configuration (
Union
[IResolvable
,FargatePlatformConfigurationProperty
,Dict
[str
,Any
],None
]) – The platform configuration for jobs that are running on Fargate resources. Jobs that are running on EC2 resources must not specify this parameter.instance_type (
Optional
[str
]) – The instance type to use for a multi-node parallel job. All node groups in a multi-node parallel job must use the same instance type. .. epigraph:: This parameter isn’t applicable to single-node container jobs or jobs that run on Fargate resources, and shouldn’t be provided.job_role_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions. For more information, see IAM roles for tasks in the Amazon Elastic Container Service Developer Guide .linux_parameters (
Union
[IResolvable
,LinuxParametersProperty
,Dict
[str
,Any
],None
]) – Linux-specific modifications that are applied to the container, such as details for device mappings.log_configuration (
Union
[IResolvable
,LogConfigurationProperty
,Dict
[str
,Any
],None
]) –The log configuration specification for the container. This parameter maps to
LogConfig
in the Create a container section of the Docker Remote API and the--log-driver
option to docker run . By default, containers use the same logging driver that the Docker daemon uses. However the container might use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation. .. epigraph:: AWS Batch currently supports a subset of the logging drivers available to the Docker daemon (shown in theLogConfiguration
data type). This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:sudo docker version | grep "Server API version"
.. epigraph:: The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with theECS_AVAILABLE_LOGGING_DRIVERS
environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide .memory (
Union
[int
,float
,None
]) – This parameter is deprecated, useresourceRequirements
to specify the memory requirements for the job definition. It’s not supported for jobs running on Fargate resources. For jobs that run on EC2 resources, it specifies the memory hard limit (in MiB) for a container. If your container attempts to exceed the specified number, it’s terminated. You must specify at least 4 MiB of memory for a job using this parameter. The memory hard limit can be specified in several places. It must be specified for each node at least once.mount_points (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,MountPointsProperty
,Dict
[str
,Any
]]],None
]) –The mount points for data volumes in your container. This parameter maps to
Volumes
in the Create a container section of the Docker Remote API and the--volume
option to docker run .network_configuration (
Union
[IResolvable
,NetworkConfigurationProperty
,Dict
[str
,Any
],None
]) – The network configuration for jobs that are running on Fargate resources. Jobs that are running on EC2 resources must not specify this parameter.privileged (
Union
[bool
,IResolvable
,None
]) –When this parameter is true, the container is given elevated permissions on the host container instance (similar to the
root
user). This parameter maps toPrivileged
in the Create a container section of the Docker Remote API and the--privileged
option to docker run . The default value is false. .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources and shouldn’t be provided, or specified as false.readonly_root_filesystem (
Union
[bool
,IResolvable
,None
]) –When this parameter is true, the container is given read-only access to its root file system. This parameter maps to
ReadonlyRootfs
in the Create a container section of the Docker Remote API and the--read-only
option todocker run
.resource_requirements (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ResourceRequirementProperty
,Dict
[str
,Any
]]],None
]) – The type and amount of resources to assign to a container. The supported resources includeGPU
,MEMORY
, andVCPU
.secrets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,SecretProperty
,Dict
[str
,Any
]]],None
]) – The secrets for the container. For more information, see Specifying sensitive data in the AWS Batch User Guide .ulimits (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,UlimitProperty
,Dict
[str
,Any
]]],None
]) –A list of
ulimits
to set in the container. This parameter maps toUlimits
in the Create a container section of the Docker Remote API and the--ulimit
option to docker run . .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources and shouldn’t be provided.user (
Optional
[str
]) –The user name to use inside the container. This parameter maps to
User
in the Create a container section of the Docker Remote API and the--user
option to docker run .vcpus (
Union
[int
,float
,None
]) –This parameter is deprecated, use
resourceRequirements
to specify the vCPU requirements for the job definition. It’s not supported for jobs running on Fargate resources. For jobs running on EC2 resources, it specifies the number of vCPUs reserved for the job. Each vCPU is equivalent to 1,024 CPU shares. This parameter maps toCpuShares
in the Create a container section of the Docker Remote API and the--cpu-shares
option to docker run . The number of vCPUs must be specified but can be specified in several places. You must specify it at least once for each node.volumes (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,VolumesProperty
,Dict
[str
,Any
]]],None
]) – A list of data volumes used in a job.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # options: Any container_properties_property = batch.CfnJobDefinition.ContainerPropertiesProperty( image="image", # the properties below are optional command=["command"], environment=[batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )], ephemeral_storage=batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 ), execution_role_arn="executionRoleArn", fargate_platform_configuration=batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" ), instance_type="instanceType", job_role_arn="jobRoleArn", linux_parameters=batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] ), log_configuration=batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] ), memory=123, mount_points=[batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )], network_configuration=batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" ), privileged=False, readonly_root_filesystem=False, resource_requirements=[batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )], secrets=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )], ulimits=[batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )], user="user", vcpus=123, volumes=[batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )] )
Attributes
- command
The command that’s passed to the container.
This parameter maps to
Cmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run . For more information, see https://docs.docker.com/engine/reference/builder/#cmd .
- environment
The environment variables to pass to a container.
This parameter maps to
Env
in the Create a container section of the Docker Remote API and the--env
option to docker run . .. epigraph:We don't recommend using plaintext environment variables for sensitive information, such as credential data. > Environment variables cannot start with " ``AWS_BATCH`` ". This naming convention is reserved for variables that AWS Batch sets.
- ephemeral_storage
CfnJobDefinition.ContainerPropertiesProperty.EphemeralStorage
.
- execution_role_arn
The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume.
For jobs that run on Fargate resources, you must provide an execution role. For more information, see AWS Batch execution IAM role in the AWS Batch User Guide .
- fargate_platform_configuration
The platform configuration for jobs that are running on Fargate resources.
Jobs that are running on EC2 resources must not specify this parameter.
- image
The image used to start a container.
This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with
*repository-url* / *image* : *tag*
. It can be 255 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), underscores (_), colons (:), periods (.), forward slashes (/), and number signs (#). This parameter maps toImage
in the Create a container section of the Docker Remote API and theIMAGE
parameter of docker run . .. epigraph:Docker image architecture must match the processor architecture of the compute resources that they're scheduled on. For example, ARM-based Docker images can only run on ARM-based compute resources.
Images in Amazon ECR Public repositories use the full
registry/repository[:tag]
orregistry/repository[@digest]
naming conventions. For example,public.ecr.aws/ *registry_alias* / *my-web-app* : *latest*
.Images in Amazon ECR repositories use the full registry and repository URI (for example,
123456789012.dkr.ecr.<region-name>.amazonaws.com/<repository-name>
).Images in official repositories on Docker Hub use a single name (for example,
ubuntu
ormongo
).Images in other repositories on Docker Hub are qualified with an organization name (for example,
amazon/amazon-ecs-agent
).Images in other online repositories are qualified further by a domain name (for example,
quay.io/assemblyline/ubuntu
).
- instance_type
The instance type to use for a multi-node parallel job.
All node groups in a multi-node parallel job must use the same instance type. .. epigraph:
This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and shouldn't be provided.
- job_role_arn
The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions.
For more information, see IAM roles for tasks in the Amazon Elastic Container Service Developer Guide .
- linux_parameters
Linux-specific modifications that are applied to the container, such as details for device mappings.
- log_configuration
The log configuration specification for the container.
This parameter maps to
LogConfig
in the Create a container section of the Docker Remote API and the--log-driver
option to docker run . By default, containers use the same logging driver that the Docker daemon uses. However the container might use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information on the options for different supported log drivers, see Configure logging drivers in the Docker documentation. .. epigraph:AWS Batch currently supports a subset of the logging drivers available to the Docker daemon (shown in the ``LogConfiguration`` data type).
This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:
sudo docker version | grep "Server API version"
.. epigraph:The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ``ECS_AVAILABLE_LOGGING_DRIVERS`` environment variable before containers placed on that instance can use these log configuration options. For more information, see `Amazon ECS container agent configuration <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html>`_ in the *Amazon Elastic Container Service Developer Guide* .
- memory
This parameter is deprecated, use
resourceRequirements
to specify the memory requirements for the job definition.It’s not supported for jobs running on Fargate resources. For jobs that run on EC2 resources, it specifies the memory hard limit (in MiB) for a container. If your container attempts to exceed the specified number, it’s terminated. You must specify at least 4 MiB of memory for a job using this parameter. The memory hard limit can be specified in several places. It must be specified for each node at least once.
- mount_points
The mount points for data volumes in your container.
This parameter maps to
Volumes
in the Create a container section of the Docker Remote API and the--volume
option to docker run .
- network_configuration
The network configuration for jobs that are running on Fargate resources.
Jobs that are running on EC2 resources must not specify this parameter.
- privileged
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the
root
user).This parameter maps to
Privileged
in the Create a container section of the Docker Remote API and the--privileged
option to docker run . The default value is false. .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources and shouldn't be provided, or specified as false.
- readonly_root_filesystem
When this parameter is true, the container is given read-only access to its root file system.
This parameter maps to
ReadonlyRootfs
in the Create a container section of the Docker Remote API and the--read-only
option todocker run
.
- resource_requirements
The type and amount of resources to assign to a container.
The supported resources include
GPU
,MEMORY
, andVCPU
.
- secrets
The secrets for the container.
For more information, see Specifying sensitive data in the AWS Batch User Guide .
- ulimits
A list of
ulimits
to set in the container.This parameter maps to
Ulimits
in the Create a container section of the Docker Remote API and the--ulimit
option to docker run . .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources and shouldn't be provided.
- user
The user name to use inside the container.
This parameter maps to
User
in the Create a container section of the Docker Remote API and the--user
option to docker run .
- vcpus
This parameter is deprecated, use
resourceRequirements
to specify the vCPU requirements for the job definition.It’s not supported for jobs running on Fargate resources. For jobs running on EC2 resources, it specifies the number of vCPUs reserved for the job.
Each vCPU is equivalent to 1,024 CPU shares. This parameter maps to
CpuShares
in the Create a container section of the Docker Remote API and the--cpu-shares
option to docker run . The number of vCPUs must be specified but can be specified in several places. You must specify it at least once for each node.
- volumes
A list of data volumes used in a job.
DeviceProperty
- class CfnJobDefinition.DeviceProperty(*, container_path=None, host_path=None, permissions=None)
Bases:
object
An object that represents a container instance host device.
This object isn’t applicable to jobs that are running on Fargate resources and shouldn’t be provided.
- Parameters:
container_path (
Optional
[str
]) – The path inside the container that’s used to expose the host device. By default, thehostPath
value is used.host_path (
Optional
[str
]) – The path for the device on the host container instance.permissions (
Optional
[Sequence
[str
]]) – The explicit permissions to provide to the container for the device. By default, the container has permissions forread
,write
, andmknod
for the device.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch device_property = batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )
Attributes
- container_path
The path inside the container that’s used to expose the host device.
By default, the
hostPath
value is used.
- host_path
The path for the device on the host container instance.
- permissions
The explicit permissions to provide to the container for the device.
By default, the container has permissions for
read
,write
, andmknod
for the device.
EfsVolumeConfigurationProperty
- class CfnJobDefinition.EfsVolumeConfigurationProperty(*, file_system_id, authorization_config=None, root_directory=None, transit_encryption=None, transit_encryption_port=None)
Bases:
object
This is used when you’re using an Amazon Elastic File System file system for job storage.
For more information, see Amazon EFS Volumes in the AWS Batch User Guide .
- Parameters:
file_system_id (
str
) – The Amazon EFS file system ID to use.authorization_config (
Union
[IResolvable
,AuthorizationConfigProperty
,Dict
[str
,Any
],None
]) – The authorization configuration details for the Amazon EFS file system.root_directory (
Optional
[str
]) – The directory within the Amazon EFS file system to mount as the root directory inside the host. If this parameter is omitted, the root of the Amazon EFS volume is used instead. Specifying/
has the same effect as omitting this parameter. The maximum length is 4,096 characters. .. epigraph:: If an EFS access point is specified in theauthorizationConfig
, the root directory parameter must either be omitted or set to/
, which enforces the path set on the Amazon EFS access point.transit_encryption (
Optional
[str
]) – Determines whether to enable encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server. Transit encryption must be enabled if Amazon EFS IAM authorization is used. If this parameter is omitted, the default value ofDISABLED
is used. For more information, see Encrypting data in transit in the Amazon Elastic File System User Guide .transit_encryption_port (
Union
[int
,float
,None
]) – The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server. If you don’t specify a transit encryption port, it uses the port selection strategy that the Amazon EFS mount helper uses. The value must be between 0 and 65,535. For more information, see EFS mount helper in the Amazon Elastic File System User Guide .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch efs_volume_configuration_property = batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 )
Attributes
- authorization_config
The authorization configuration details for the Amazon EFS file system.
- file_system_id
The Amazon EFS file system ID to use.
- root_directory
The directory within the Amazon EFS file system to mount as the root directory inside the host.
If this parameter is omitted, the root of the Amazon EFS volume is used instead. Specifying
/
has the same effect as omitting this parameter. The maximum length is 4,096 characters. .. epigraph:If an EFS access point is specified in the ``authorizationConfig`` , the root directory parameter must either be omitted or set to ``/`` , which enforces the path set on the Amazon EFS access point.
- transit_encryption
Determines whether to enable encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server.
Transit encryption must be enabled if Amazon EFS IAM authorization is used. If this parameter is omitted, the default value of
DISABLED
is used. For more information, see Encrypting data in transit in the Amazon Elastic File System User Guide .
- transit_encryption_port
The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server.
If you don’t specify a transit encryption port, it uses the port selection strategy that the Amazon EFS mount helper uses. The value must be between 0 and 65,535. For more information, see EFS mount helper in the Amazon Elastic File System User Guide .
EksContainerEnvironmentVariableProperty
- class CfnJobDefinition.EksContainerEnvironmentVariableProperty(*, name, value=None)
Bases:
object
An environment variable.
- Parameters:
name (
str
) – The name of the environment variable.value (
Optional
[str
]) – The value of the environment variable.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch eks_container_environment_variable_property = batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty( name="name", # the properties below are optional value="value" )
Attributes
- name
The name of the environment variable.
- value
The value of the environment variable.
EksContainerProperty
- class CfnJobDefinition.EksContainerProperty(*, image, args=None, command=None, env=None, image_pull_policy=None, name=None, resources=None, security_context=None, volume_mounts=None)
Bases:
object
EKS container properties are used in job definitions for Amazon EKS based job definitions to describe the properties for a container node in the pod that’s launched as part of a job.
This can’t be specified for Amazon ECS based job definitions.
- Parameters:
image (
str
) – The Docker image used to start the container.args (
Optional
[Sequence
[str
]]) – An array of arguments to the entrypoint. If this isn’t specified, theCMD
of the container image is used. This corresponds to theargs
member in the Entrypoint portion of the Pod in Kubernetes. Environment variable references are expanded using the container’s environment. If the referenced environment variable doesn’t exist, the reference in the command isn’t changed. For example, if the reference is to “$(NAME1)
“ and theNAME1
environment variable doesn’t exist, the command string will remain “$(NAME1)
.”$$
is replaced with$
, and the resulting string isn’t expanded. For example,$$(VAR_NAME)
is passed as$(VAR_NAME)
whether or not theVAR_NAME
environment variable exists. For more information, see CMD in the Dockerfile reference and Define a command and arguments for a pod in the Kubernetes documentation .command (
Optional
[Sequence
[str
]]) –The entrypoint for the container. This isn’t run within a shell. If this isn’t specified, the
ENTRYPOINT
of the container image is used. Environment variable references are expanded using the container’s environment. If the referenced environment variable doesn’t exist, the reference in the command isn’t changed. For example, if the reference is to “$(NAME1)
“ and theNAME1
environment variable doesn’t exist, the command string will remain “$(NAME1)
.”$$
is replaced with$
and the resulting string isn’t expanded. For example,$$(VAR_NAME)
will be passed as$(VAR_NAME)
whether or not theVAR_NAME
environment variable exists. The entrypoint can’t be updated. For more information, see ENTRYPOINT in the Dockerfile reference and Define a command and arguments for a container and Entrypoint in the Kubernetes documentation .env (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EksContainerEnvironmentVariableProperty
,Dict
[str
,Any
]]],None
]) – The environment variables to pass to a container. .. epigraph:: Environment variables cannot start with “AWS_BATCH
“. This naming convention is reserved for variables that AWS Batch sets.image_pull_policy (
Optional
[str
]) – The image pull policy for the container. Supported values areAlways
,IfNotPresent
, andNever
. This parameter defaults toIfNotPresent
. However, if the:latest
tag is specified, it defaults toAlways
. For more information, see Updating images in the Kubernetes documentation .name (
Optional
[str
]) – The name of the container. If the name isn’t specified, the default name “Default
“ is used. Each container in a pod must have a unique name.resources (
Union
[IResolvable
,ResourcesProperty
,Dict
[str
,Any
],None
]) – The type and amount of resources to assign to a container. The supported resources includememory
,cpu
, andnvidia.com/gpu
. For more information, see Resource management for pods and containers in the Kubernetes documentation .security_context (
Union
[IResolvable
,SecurityContextProperty
,Dict
[str
,Any
],None
]) – The security context for a job. For more information, see Configure a security context for a pod or container in the Kubernetes documentation .volume_mounts (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EksContainerVolumeMountProperty
,Dict
[str
,Any
]]],None
]) – The volume mounts for the container. AWS Batch supportsemptyDir
,hostPath
, andsecret
volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes documentation .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # limits: Any # requests: Any eks_container_property = batch.CfnJobDefinition.EksContainerProperty( image="image", # the properties below are optional args=["args"], command=["command"], env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty( name="name", # the properties below are optional value="value" )], image_pull_policy="imagePullPolicy", name="name", resources=batch.CfnJobDefinition.ResourcesProperty( limits=limits, requests=requests ), security_context=batch.CfnJobDefinition.SecurityContextProperty( privileged=False, read_only_root_filesystem=False, run_as_group=123, run_as_non_root=False, run_as_user=123 ), volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty( mount_path="mountPath", name="name", read_only=False )] )
Attributes
- args
An array of arguments to the entrypoint.
If this isn’t specified, the
CMD
of the container image is used. This corresponds to theargs
member in the Entrypoint portion of the Pod in Kubernetes. Environment variable references are expanded using the container’s environment.If the referenced environment variable doesn’t exist, the reference in the command isn’t changed. For example, if the reference is to “
$(NAME1)
“ and theNAME1
environment variable doesn’t exist, the command string will remain “$(NAME1)
.”$$
is replaced with$
, and the resulting string isn’t expanded. For example,$$(VAR_NAME)
is passed as$(VAR_NAME)
whether or not theVAR_NAME
environment variable exists. For more information, see CMD in the Dockerfile reference and Define a command and arguments for a pod in the Kubernetes documentation .
- command
The entrypoint for the container.
This isn’t run within a shell. If this isn’t specified, the
ENTRYPOINT
of the container image is used. Environment variable references are expanded using the container’s environment.If the referenced environment variable doesn’t exist, the reference in the command isn’t changed. For example, if the reference is to “
$(NAME1)
“ and theNAME1
environment variable doesn’t exist, the command string will remain “$(NAME1)
.”$$
is replaced with$
and the resulting string isn’t expanded. For example,$$(VAR_NAME)
will be passed as$(VAR_NAME)
whether or not theVAR_NAME
environment variable exists. The entrypoint can’t be updated. For more information, see ENTRYPOINT in the Dockerfile reference and Define a command and arguments for a container and Entrypoint in the Kubernetes documentation .
- env
The environment variables to pass to a container.
Environment variables cannot start with “
AWS_BATCH
“. This naming convention is reserved for variables that AWS Batch sets.
- image
The Docker image used to start the container.
- image_pull_policy
The image pull policy for the container.
Supported values are
Always
,IfNotPresent
, andNever
. This parameter defaults toIfNotPresent
. However, if the:latest
tag is specified, it defaults toAlways
. For more information, see Updating images in the Kubernetes documentation .
- name
The name of the container.
If the name isn’t specified, the default name “
Default
“ is used. Each container in a pod must have a unique name.
- resources
The type and amount of resources to assign to a container.
The supported resources include
memory
,cpu
, andnvidia.com/gpu
. For more information, see Resource management for pods and containers in the Kubernetes documentation .
- security_context
The security context for a job.
For more information, see Configure a security context for a pod or container in the Kubernetes documentation .
EksContainerVolumeMountProperty
- class CfnJobDefinition.EksContainerVolumeMountProperty(*, mount_path=None, name=None, read_only=None)
Bases:
object
The volume mounts for a container for an Amazon EKS job.
For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes documentation .
- Parameters:
mount_path (
Optional
[str
]) – The path on the container where the volume is mounted.name (
Optional
[str
]) – The name the volume mount. This must match the name of one of the volumes in the pod.read_only (
Union
[bool
,IResolvable
,None
]) – If this value istrue
, the container has read-only access to the volume. Otherwise, the container can write to the volume. The default value isfalse
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch eks_container_volume_mount_property = batch.CfnJobDefinition.EksContainerVolumeMountProperty( mount_path="mountPath", name="name", read_only=False )
Attributes
- mount_path
The path on the container where the volume is mounted.
- name
The name the volume mount.
This must match the name of one of the volumes in the pod.
- read_only
If this value is
true
, the container has read-only access to the volume.Otherwise, the container can write to the volume. The default value is
false
.
EksPropertiesProperty
- class CfnJobDefinition.EksPropertiesProperty(*, pod_properties=None)
Bases:
object
An object that contains the properties for the Kubernetes resources of a job.
- Parameters:
pod_properties (
Union
[IResolvable
,PodPropertiesProperty
,Dict
[str
,Any
],None
]) – The properties for the Kubernetes pod resources of a job.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # labels: Any # limits: Any # requests: Any eks_properties_property = batch.CfnJobDefinition.EksPropertiesProperty( pod_properties=batch.CfnJobDefinition.PodPropertiesProperty( containers=[batch.CfnJobDefinition.EksContainerProperty( image="image", # the properties below are optional args=["args"], command=["command"], env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty( name="name", # the properties below are optional value="value" )], image_pull_policy="imagePullPolicy", name="name", resources=batch.CfnJobDefinition.ResourcesProperty( limits=limits, requests=requests ), security_context=batch.CfnJobDefinition.SecurityContextProperty( privileged=False, read_only_root_filesystem=False, run_as_group=123, run_as_non_root=False, run_as_user=123 ), volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty( mount_path="mountPath", name="name", read_only=False )] )], dns_policy="dnsPolicy", host_network=False, metadata=batch.CfnJobDefinition.MetadataProperty( labels=labels ), service_account_name="serviceAccountName", volumes=[batch.CfnJobDefinition.EksVolumeProperty( name="name", # the properties below are optional empty_dir=batch.CfnJobDefinition.EmptyDirProperty( medium="medium", size_limit="sizeLimit" ), host_path=batch.CfnJobDefinition.HostPathProperty( path="path" ), secret=batch.CfnJobDefinition.EksSecretProperty( secret_name="secretName", # the properties below are optional optional=False ) )] ) )
Attributes
- pod_properties
The properties for the Kubernetes pod resources of a job.
EksSecretProperty
- class CfnJobDefinition.EksSecretProperty(*, secret_name, optional=None)
Bases:
object
- Parameters:
secret_name (
str
) –CfnJobDefinition.EksSecretProperty.SecretName
.optional (
Union
[bool
,IResolvable
,None
]) –CfnJobDefinition.EksSecretProperty.Optional
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch eks_secret_property = batch.CfnJobDefinition.EksSecretProperty( secret_name="secretName", # the properties below are optional optional=False )
Attributes
- optional
CfnJobDefinition.EksSecretProperty.Optional
.
- secret_name
CfnJobDefinition.EksSecretProperty.SecretName
.
EksVolumeProperty
- class CfnJobDefinition.EksVolumeProperty(*, name, empty_dir=None, host_path=None, secret=None)
Bases:
object
Specifies an Amazon EKS volume for a job definition.
- Parameters:
name (
str
) – The name of the volume. The name must be allowed as a DNS subdomain name. For more information, see DNS subdomain names in the Kubernetes documentation .empty_dir (
Union
[IResolvable
,EmptyDirProperty
,Dict
[str
,Any
],None
]) – Specifies the configuration of a KubernetesemptyDir
volume. For more information, see emptyDir in the Kubernetes documentation .host_path (
Union
[IResolvable
,HostPathProperty
,Dict
[str
,Any
],None
]) – Specifies the configuration of a KuberneteshostPath
volume. For more information, see hostPath in the Kubernetes documentation .secret (
Union
[IResolvable
,EksSecretProperty
,Dict
[str
,Any
],None
]) – Specifies the configuration of a Kubernetessecret
volume. For more information, see secret in the Kubernetes documentation .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch eks_volume_property = batch.CfnJobDefinition.EksVolumeProperty( name="name", # the properties below are optional empty_dir=batch.CfnJobDefinition.EmptyDirProperty( medium="medium", size_limit="sizeLimit" ), host_path=batch.CfnJobDefinition.HostPathProperty( path="path" ), secret=batch.CfnJobDefinition.EksSecretProperty( secret_name="secretName", # the properties below are optional optional=False ) )
Attributes
- empty_dir
Specifies the configuration of a Kubernetes
emptyDir
volume.For more information, see emptyDir in the Kubernetes documentation .
- host_path
Specifies the configuration of a Kubernetes
hostPath
volume.For more information, see hostPath in the Kubernetes documentation .
- name
The name of the volume.
The name must be allowed as a DNS subdomain name. For more information, see DNS subdomain names in the Kubernetes documentation .
EmptyDirProperty
- class CfnJobDefinition.EmptyDirProperty(*, medium=None, size_limit=None)
Bases:
object
- Parameters:
medium (
Optional
[str
]) –CfnJobDefinition.EmptyDirProperty.Medium
.size_limit (
Optional
[str
]) –CfnJobDefinition.EmptyDirProperty.SizeLimit
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch empty_dir_property = batch.CfnJobDefinition.EmptyDirProperty( medium="medium", size_limit="sizeLimit" )
Attributes
- medium
CfnJobDefinition.EmptyDirProperty.Medium
.
- size_limit
CfnJobDefinition.EmptyDirProperty.SizeLimit
.
EnvironmentProperty
- class CfnJobDefinition.EnvironmentProperty(*, name=None, value=None)
Bases:
object
The Environment property type specifies environment variables to use in a job definition.
- Parameters:
name (
Optional
[str
]) – The name of the environment variable.value (
Optional
[str
]) – The value of the environment variable.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch environment_property = batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )
Attributes
- name
The name of the environment variable.
- value
The value of the environment variable.
EphemeralStorageProperty
- class CfnJobDefinition.EphemeralStorageProperty(*, size_in_gib)
Bases:
object
- Parameters:
size_in_gib (
Union
[int
,float
]) –CfnJobDefinition.EphemeralStorageProperty.SizeInGiB
.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch ephemeral_storage_property = batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 )
Attributes
- size_in_gib
CfnJobDefinition.EphemeralStorageProperty.SizeInGiB
.
EvaluateOnExitProperty
- class CfnJobDefinition.EvaluateOnExitProperty(*, action, on_exit_code=None, on_reason=None, on_status_reason=None)
Bases:
object
Specifies an array of up to 5 conditions to be met, and an action to take (
RETRY
orEXIT
) if all conditions are met.If none of the
EvaluateOnExit
conditions in aRetryStrategy
match, then the job is retried.- Parameters:
action (
str
) – Specifies the action to take if all of the specified conditions (onStatusReason
,onReason
, andonExitCode
) are met. The values aren’t case sensitive.on_exit_code (
Optional
[str
]) – Contains a glob pattern to match against the decimal representation of theExitCode
returned for a job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*) so that only the start of the string needs to be an exact match. The string can contain up to 512 characters.on_reason (
Optional
[str
]) – Contains a glob pattern to match against theReason
returned for a job. The pattern can contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.on_status_reason (
Optional
[str
]) – Contains a glob pattern to match against theStatusReason
returned for a job. The pattern can contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch evaluate_on_exit_property = batch.CfnJobDefinition.EvaluateOnExitProperty( action="action", # the properties below are optional on_exit_code="onExitCode", on_reason="onReason", on_status_reason="onStatusReason" )
Attributes
- action
Specifies the action to take if all of the specified conditions (
onStatusReason
,onReason
, andonExitCode
) are met.The values aren’t case sensitive.
- on_exit_code
Contains a glob pattern to match against the decimal representation of the
ExitCode
returned for a job.The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*) so that only the start of the string needs to be an exact match.
The string can contain up to 512 characters.
- on_reason
Contains a glob pattern to match against the
Reason
returned for a job.The pattern can contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.
- on_status_reason
Contains a glob pattern to match against the
StatusReason
returned for a job.The pattern can contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.
FargatePlatformConfigurationProperty
- class CfnJobDefinition.FargatePlatformConfigurationProperty(*, platform_version=None)
Bases:
object
The platform configuration for jobs that are running on Fargate resources.
Jobs that run on EC2 resources must not specify this parameter.
- Parameters:
platform_version (
Optional
[str
]) – The AWS Fargate platform version where the jobs are running. A platform version is specified only for jobs that are running on Fargate resources. If one isn’t specified, theLATEST
platform version is used by default. This uses a recent, approved version of the AWS Fargate platform for compute resources. For more information, see AWS Fargate platform versions in the Amazon Elastic Container Service Developer Guide .- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch fargate_platform_configuration_property = batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" )
Attributes
- platform_version
The AWS Fargate platform version where the jobs are running.
A platform version is specified only for jobs that are running on Fargate resources. If one isn’t specified, the
LATEST
platform version is used by default. This uses a recent, approved version of the AWS Fargate platform for compute resources. For more information, see AWS Fargate platform versions in the Amazon Elastic Container Service Developer Guide .
HostPathProperty
- class CfnJobDefinition.HostPathProperty(*, path=None)
Bases:
object
- Parameters:
path (
Optional
[str
]) –CfnJobDefinition.HostPathProperty.Path
.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch host_path_property = batch.CfnJobDefinition.HostPathProperty( path="path" )
Attributes
- path
CfnJobDefinition.HostPathProperty.Path
.
LinuxParametersProperty
- class CfnJobDefinition.LinuxParametersProperty(*, devices=None, init_process_enabled=None, max_swap=None, shared_memory_size=None, swappiness=None, tmpfs=None)
Bases:
object
Linux-specific modifications that are applied to the container, such as details for device mappings.
- Parameters:
devices (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,DeviceProperty
,Dict
[str
,Any
]]],None
]) –Any of the host devices to expose to the container. This parameter maps to
Devices
in the Create a container section of the Docker Remote API and the--device
option to docker run . .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide it for these jobs.init_process_enabled (
Union
[bool
,IResolvable
,None
]) –If true, run an
init
process inside the container that forwards signals and reaps processes. This parameter maps to the--init
option to docker run . This parameter requires version 1.25 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:sudo docker version | grep "Server API version"
max_swap (
Union
[int
,float
,None
]) –The total amount of swap memory (in MiB) a container can use. This parameter is translated to the
--memory-swap
option to docker run where the value is the sum of the container memory plus themaxSwap
value. For more information, see`--memory-swap
details <https://docs.aws.amazon.com/https://docs.docker.com/config/containers/resource_constraints/#–memory-swap-details>`_ in the Docker documentation. If amaxSwap
value of0
is specified, the container doesn’t use swap. Accepted values are0
or any positive integer. If themaxSwap
parameter is omitted, the container doesn’t use the swap configuration for the container instance that it’s running on. AmaxSwap
value must be set for theswappiness
parameter to be used. .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide it for these jobs.shared_memory_size (
Union
[int
,float
,None
]) –The value for the size (in MiB) of the
/dev/shm
volume. This parameter maps to the--shm-size
option to docker run . .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide it for these jobs.swappiness (
Union
[int
,float
,None
]) –You can use this parameter to tune a container’s memory swappiness behavior. A
swappiness
value of0
causes swapping to not occur unless absolutely necessary. Aswappiness
value of100
causes pages to be swapped aggressively. Valid values are whole numbers between0
and100
. If theswappiness
parameter isn’t specified, a default value of60
is used. If a value isn’t specified formaxSwap
, then this parameter is ignored. IfmaxSwap
is set to 0, the container doesn’t use swap. This parameter maps to the--memory-swappiness
option to docker run . Consider the following when you use a per-container swap configuration. - Swap space must be enabled and allocated on the container instance for the containers to use. .. epigraph:: By default, the Amazon ECS optimized AMIs don’t have swap enabled. You must enable swap on the instance to use this feature. For more information, see Instance store swap volumes in the Amazon EC2 User Guide for Linux Instances or How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file? - The swap space parameters are only supported for job definitions using EC2 resources. - If themaxSwap
andswappiness
parameters are omitted from a job definition, each container has a defaultswappiness
value of 60. Moreover, the total swap usage is limited to two times the memory reservation of the container. .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide it for these jobs.tmpfs (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TmpfsProperty
,Dict
[str
,Any
]]],None
]) –The container path, mount options, and size (in MiB) of the
tmpfs
mount. This parameter maps to the--tmpfs
option to docker run . .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide this parameter for this resource type.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch linux_parameters_property = batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] )
Attributes
- devices
Any of the host devices to expose to the container.
This parameter maps to
Devices
in the Create a container section of the Docker Remote API and the--device
option to docker run . .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.
- init_process_enabled
If true, run an
init
process inside the container that forwards signals and reaps processes.This parameter maps to the
--init
option to docker run . This parameter requires version 1.25 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:sudo docker version | grep "Server API version"
- max_swap
The total amount of swap memory (in MiB) a container can use.
This parameter is translated to the
--memory-swap
option to docker run where the value is the sum of the container memory plus themaxSwap
value. For more information, see`--memory-swap
details <https://docs.aws.amazon.com/https://docs.docker.com/config/containers/resource_constraints/#–memory-swap-details>`_ in the Docker documentation.If a
maxSwap
value of0
is specified, the container doesn’t use swap. Accepted values are0
or any positive integer. If themaxSwap
parameter is omitted, the container doesn’t use the swap configuration for the container instance that it’s running on. AmaxSwap
value must be set for theswappiness
parameter to be used. .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.
The value for the size (in MiB) of the
/dev/shm
volume.This parameter maps to the
--shm-size
option to docker run . .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.
- swappiness
You can use this parameter to tune a container’s memory swappiness behavior.
A
swappiness
value of0
causes swapping to not occur unless absolutely necessary. Aswappiness
value of100
causes pages to be swapped aggressively. Valid values are whole numbers between0
and100
. If theswappiness
parameter isn’t specified, a default value of60
is used. If a value isn’t specified formaxSwap
, then this parameter is ignored. IfmaxSwap
is set to 0, the container doesn’t use swap. This parameter maps to the--memory-swappiness
option to docker run .Consider the following when you use a per-container swap configuration.
Swap space must be enabled and allocated on the container instance for the containers to use.
By default, the Amazon ECS optimized AMIs don’t have swap enabled. You must enable swap on the instance to use this feature. For more information, see Instance store swap volumes in the Amazon EC2 User Guide for Linux Instances or How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?
The swap space parameters are only supported for job definitions using EC2 resources.
If the
maxSwap
andswappiness
parameters are omitted from a job definition, each container has a defaultswappiness
value of 60. Moreover, the total swap usage is limited to two times the memory reservation of the container.
This parameter isn’t applicable to jobs that are running on Fargate resources. Don’t provide it for these jobs.
- tmpfs
The container path, mount options, and size (in MiB) of the
tmpfs
mount.This parameter maps to the
--tmpfs
option to docker run . .. epigraph:This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide this parameter for this resource type.
LogConfigurationProperty
- class CfnJobDefinition.LogConfigurationProperty(*, log_driver, options=None, secret_options=None)
Bases:
object
Log configuration options to send to a custom log driver for the container.
- Parameters:
log_driver (
str
) – The log driver to use for the container. The valid values that are listed for this parameter are log drivers that the Amazon ECS container agent can communicate with by default. The supported log drivers areawslogs
,fluentd
,gelf
,json-file
,journald
,logentries
,syslog
, andsplunk
. .. epigraph:: Jobs that are running on Fargate resources are restricted to theawslogs
andsplunk
log drivers. - awslogs - Specifies the Amazon CloudWatch Logs logging driver. For more information, see Using the awslogs log driver in the AWS Batch User Guide and Amazon CloudWatch Logs logging driver in the Docker documentation. - fluentd - Specifies the Fluentd logging driver. For more information including usage and options, see Fluentd logging driver in the Docker documentation . - gelf - Specifies the Graylog Extended Format (GELF) logging driver. For more information including usage and options, see Graylog Extended Format logging driver in the Docker documentation . - journald - Specifies the journald logging driver. For more information including usage and options, see Journald logging driver in the Docker documentation . - json-file - Specifies the JSON file logging driver. For more information including usage and options, see JSON File logging driver in the Docker documentation . - splunk - Specifies the Splunk logging driver. For more information including usage and options, see Splunk logging driver in the Docker documentation . - syslog - Specifies the syslog logging driver. For more information including usage and options, see Syslog logging driver in the Docker documentation . .. epigraph:: If you have a custom driver that’s not listed earlier that you want to work with the Amazon ECS container agent, you can fork the Amazon ECS container agent project that’s available on GitHub and customize it to work with that driver. We encourage you to submit pull requests for changes that you want to have included. However, Amazon Web Services doesn’t currently support running modified copies of this software. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:sudo docker version | grep "Server API version"
options (
Optional
[Any
]) – The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:sudo docker version | grep "Server API version"
secret_options (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,SecretProperty
,Dict
[str
,Any
]]],None
]) –The secrets to pass to the log configuration. For more information, see Specifying sensitive data in the AWS Batch User Guide .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # options: Any log_configuration_property = batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] )
Attributes
- log_driver
The log driver to use for the container.
The valid values that are listed for this parameter are log drivers that the Amazon ECS container agent can communicate with by default.
The supported log drivers are
awslogs
,fluentd
,gelf
,json-file
,journald
,logentries
,syslog
, andsplunk
. .. epigraph:Jobs that are running on Fargate resources are restricted to the ``awslogs`` and ``splunk`` log drivers.
awslogs - Specifies the Amazon CloudWatch Logs logging driver. For more information, see Using the awslogs log driver in the AWS Batch User Guide and Amazon CloudWatch Logs logging driver in the Docker documentation.
fluentd - Specifies the Fluentd logging driver. For more information including usage and options, see Fluentd logging driver in the Docker documentation .
gelf - Specifies the Graylog Extended Format (GELF) logging driver. For more information including usage and options, see Graylog Extended Format logging driver in the Docker documentation .
journald - Specifies the journald logging driver. For more information including usage and options, see Journald logging driver in the Docker documentation .
json-file - Specifies the JSON file logging driver. For more information including usage and options, see JSON File logging driver in the Docker documentation .
splunk - Specifies the Splunk logging driver. For more information including usage and options, see Splunk logging driver in the Docker documentation .
syslog - Specifies the syslog logging driver. For more information including usage and options, see Syslog logging driver in the Docker documentation .
If you have a custom driver that’s not listed earlier that you want to work with the Amazon ECS container agent, you can fork the Amazon ECS container agent project that’s available on GitHub and customize it to work with that driver. We encourage you to submit pull requests for changes that you want to have included. However, Amazon Web Services doesn’t currently support running modified copies of this software.
This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:
sudo docker version | grep "Server API version"
- options
The configuration options to send to the log driver.
This parameter requires version 1.19 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command:
sudo docker version | grep "Server API version"
- secret_options
The secrets to pass to the log configuration.
For more information, see Specifying sensitive data in the AWS Batch User Guide .
MetadataProperty
- class CfnJobDefinition.MetadataProperty(*, labels=None)
Bases:
object
- Parameters:
labels (
Optional
[Any
]) –CfnJobDefinition.MetadataProperty.Labels
.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # labels: Any metadata_property = batch.CfnJobDefinition.MetadataProperty( labels=labels )
Attributes
- labels
CfnJobDefinition.MetadataProperty.Labels
.
MountPointsProperty
- class CfnJobDefinition.MountPointsProperty(*, container_path=None, read_only=None, source_volume=None)
Bases:
object
Details for a Docker volume mount point that’s used in a job’s container properties.
This parameter maps to
Volumes
in the Create a container section of the Docker Remote API and the--volume
option to docker run.- Parameters:
container_path (
Optional
[str
]) – The path on the container where the host volume is mounted.read_only (
Union
[bool
,IResolvable
,None
]) – If this value istrue
, the container has read-only access to the volume. Otherwise, the container can write to the volume. The default value isfalse
.source_volume (
Optional
[str
]) – The name of the volume to mount.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch mount_points_property = batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )
Attributes
- container_path
The path on the container where the host volume is mounted.
- read_only
If this value is
true
, the container has read-only access to the volume.Otherwise, the container can write to the volume. The default value is
false
.
- source_volume
The name of the volume to mount.
NetworkConfigurationProperty
- class CfnJobDefinition.NetworkConfigurationProperty(*, assign_public_ip=None)
Bases:
object
The network configuration for jobs that are running on Fargate resources.
Jobs that are running on EC2 resources must not specify this parameter.
- Parameters:
assign_public_ip (
Optional
[str
]) – 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. For more information, see Amazon ECS task networking in the Amazon Elastic Container Service Developer Guide . The default value is “DISABLED
“.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch network_configuration_property = batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" )
Attributes
- 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. For more information, see Amazon ECS task networking in the Amazon Elastic Container Service Developer Guide . The default value is “
DISABLED
“.
NodePropertiesProperty
- class CfnJobDefinition.NodePropertiesProperty(*, main_node, node_range_properties, num_nodes)
Bases:
object
An object that represents the node properties of a multi-node parallel job.
Node properties can’t be specified for Amazon EKS based job definitions.
- Parameters:
main_node (
Union
[int
,float
]) – Specifies the node index for the main node of a multi-node parallel job. This node index value must be fewer than the number of nodes.node_range_properties (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,NodeRangePropertyProperty
,Dict
[str
,Any
]]]]) – A list of node ranges and their properties that are associated with a multi-node parallel job.num_nodes (
Union
[int
,float
]) – The number of nodes that are associated with a multi-node parallel job.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # options: Any node_properties_property = batch.CfnJobDefinition.NodePropertiesProperty( main_node=123, node_range_properties=[batch.CfnJobDefinition.NodeRangePropertyProperty( target_nodes="targetNodes", # the properties below are optional container=batch.CfnJobDefinition.ContainerPropertiesProperty( image="image", # the properties below are optional command=["command"], environment=[batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )], ephemeral_storage=batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 ), execution_role_arn="executionRoleArn", fargate_platform_configuration=batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" ), instance_type="instanceType", job_role_arn="jobRoleArn", linux_parameters=batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] ), log_configuration=batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] ), memory=123, mount_points=[batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )], network_configuration=batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" ), privileged=False, readonly_root_filesystem=False, resource_requirements=[batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )], secrets=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )], ulimits=[batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )], user="user", vcpus=123, volumes=[batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )] ) )], num_nodes=123 )
Attributes
- main_node
Specifies the node index for the main node of a multi-node parallel job.
This node index value must be fewer than the number of nodes.
- node_range_properties
A list of node ranges and their properties that are associated with a multi-node parallel job.
- num_nodes
The number of nodes that are associated with a multi-node parallel job.
NodeRangePropertyProperty
- class CfnJobDefinition.NodeRangePropertyProperty(*, target_nodes, container=None)
Bases:
object
An object that represents the properties of the node range for a multi-node parallel job.
- Parameters:
target_nodes (
str
) – The range of nodes, using node index values. A range of0:3
indicates nodes with index values of0
through3
. If the starting range value is omitted (:n
), then0
is used to start the range. If the ending range value is omitted (n:
), then the highest possible node index is used to end the range. Your accumulative node ranges must account for all nodes (0:n
). You can nest node ranges (for example,0:10
and4:5
). In this case, the4:5
range properties override the0:10
properties.container (
Union
[IResolvable
,ContainerPropertiesProperty
,Dict
[str
,Any
],None
]) – The container details for the node range.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # options: Any node_range_property_property = batch.CfnJobDefinition.NodeRangePropertyProperty( target_nodes="targetNodes", # the properties below are optional container=batch.CfnJobDefinition.ContainerPropertiesProperty( image="image", # the properties below are optional command=["command"], environment=[batch.CfnJobDefinition.EnvironmentProperty( name="name", value="value" )], ephemeral_storage=batch.CfnJobDefinition.EphemeralStorageProperty( size_in_gi_b=123 ), execution_role_arn="executionRoleArn", fargate_platform_configuration=batch.CfnJobDefinition.FargatePlatformConfigurationProperty( platform_version="platformVersion" ), instance_type="instanceType", job_role_arn="jobRoleArn", linux_parameters=batch.CfnJobDefinition.LinuxParametersProperty( devices=[batch.CfnJobDefinition.DeviceProperty( container_path="containerPath", host_path="hostPath", permissions=["permissions"] )], init_process_enabled=False, max_swap=123, shared_memory_size=123, swappiness=123, tmpfs=[batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )] ), log_configuration=batch.CfnJobDefinition.LogConfigurationProperty( log_driver="logDriver", # the properties below are optional options=options, secret_options=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )] ), memory=123, mount_points=[batch.CfnJobDefinition.MountPointsProperty( container_path="containerPath", read_only=False, source_volume="sourceVolume" )], network_configuration=batch.CfnJobDefinition.NetworkConfigurationProperty( assign_public_ip="assignPublicIp" ), privileged=False, readonly_root_filesystem=False, resource_requirements=[batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )], secrets=[batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )], ulimits=[batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )], user="user", vcpus=123, volumes=[batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )] ) )
Attributes
- container
The container details for the node range.
- target_nodes
The range of nodes, using node index values.
A range of
0:3
indicates nodes with index values of0
through3
. If the starting range value is omitted (:n
), then0
is used to start the range. If the ending range value is omitted (n:
), then the highest possible node index is used to end the range. Your accumulative node ranges must account for all nodes (0:n
). You can nest node ranges (for example,0:10
and4:5
). In this case, the4:5
range properties override the0:10
properties.
PodPropertiesProperty
- class CfnJobDefinition.PodPropertiesProperty(*, containers=None, dns_policy=None, host_network=None, metadata=None, service_account_name=None, volumes=None)
Bases:
object
The properties for the pod.
- Parameters:
containers (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EksContainerProperty
,Dict
[str
,Any
]]],None
]) – The properties of the container that’s used on the Amazon EKS pod.dns_policy (
Optional
[str
]) – The DNS policy for the pod. The default value isClusterFirst
. If thehostNetwork
parameter is not specified, the default isClusterFirstWithHostNet
.ClusterFirst
indicates that any DNS query that does not match the configured cluster domain suffix is forwarded to the upstream nameserver inherited from the node. If no value was specified fordnsPolicy
in the RegisterJobDefinition API operation, then no value will be returned fordnsPolicy
by either of DescribeJobDefinitions or DescribeJobs API operations. The pod spec setting will contain eitherClusterFirst
orClusterFirstWithHostNet
, depending on the value of thehostNetwork
parameter. For more information, see Pod’s DNS policy in the Kubernetes documentation . Valid values:Default
|ClusterFirst
|ClusterFirstWithHostNet
host_network (
Union
[bool
,IResolvable
,None
]) – Indicates if the pod uses the hosts’ network IP address. The default value istrue
. Setting this tofalse
enables the Kubernetes pod networking model. Most AWS Batch workloads are egress-only and don’t require the overhead of IP allocation for each pod for incoming connections. For more information, see Host namespaces and Pod networking in the Kubernetes documentation .metadata (
Union
[IResolvable
,MetadataProperty
,Dict
[str
,Any
],None
]) –CfnJobDefinition.PodPropertiesProperty.Metadata
.service_account_name (
Optional
[str
]) – The name of the service account that’s used to run the pod. For more information, see Kubernetes service accounts and Configure a Kubernetes service account to assume an IAM role in the Amazon EKS User Guide and Configure service accounts for pods in the Kubernetes documentation .volumes (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EksVolumeProperty
,Dict
[str
,Any
]]],None
]) – Specifies the volumes for a job definition that uses Amazon EKS resources.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # labels: Any # limits: Any # requests: Any pod_properties_property = batch.CfnJobDefinition.PodPropertiesProperty( containers=[batch.CfnJobDefinition.EksContainerProperty( image="image", # the properties below are optional args=["args"], command=["command"], env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty( name="name", # the properties below are optional value="value" )], image_pull_policy="imagePullPolicy", name="name", resources=batch.CfnJobDefinition.ResourcesProperty( limits=limits, requests=requests ), security_context=batch.CfnJobDefinition.SecurityContextProperty( privileged=False, read_only_root_filesystem=False, run_as_group=123, run_as_non_root=False, run_as_user=123 ), volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty( mount_path="mountPath", name="name", read_only=False )] )], dns_policy="dnsPolicy", host_network=False, metadata=batch.CfnJobDefinition.MetadataProperty( labels=labels ), service_account_name="serviceAccountName", volumes=[batch.CfnJobDefinition.EksVolumeProperty( name="name", # the properties below are optional empty_dir=batch.CfnJobDefinition.EmptyDirProperty( medium="medium", size_limit="sizeLimit" ), host_path=batch.CfnJobDefinition.HostPathProperty( path="path" ), secret=batch.CfnJobDefinition.EksSecretProperty( secret_name="secretName", # the properties below are optional optional=False ) )] )
Attributes
- containers
The properties of the container that’s used on the Amazon EKS pod.
- dns_policy
The DNS policy for the pod.
The default value is
ClusterFirst
. If thehostNetwork
parameter is not specified, the default isClusterFirstWithHostNet
.ClusterFirst
indicates that any DNS query that does not match the configured cluster domain suffix is forwarded to the upstream nameserver inherited from the node. If no value was specified fordnsPolicy
in the RegisterJobDefinition API operation, then no value will be returned fordnsPolicy
by either of DescribeJobDefinitions or DescribeJobs API operations. The pod spec setting will contain eitherClusterFirst
orClusterFirstWithHostNet
, depending on the value of thehostNetwork
parameter. For more information, see Pod’s DNS policy in the Kubernetes documentation .Valid values:
Default
|ClusterFirst
|ClusterFirstWithHostNet
- host_network
Indicates if the pod uses the hosts’ network IP address.
The default value is
true
. Setting this tofalse
enables the Kubernetes pod networking model. Most AWS Batch workloads are egress-only and don’t require the overhead of IP allocation for each pod for incoming connections. For more information, see Host namespaces and Pod networking in the Kubernetes documentation .
- metadata
CfnJobDefinition.PodPropertiesProperty.Metadata
.
- service_account_name
The name of the service account that’s used to run the pod.
For more information, see Kubernetes service accounts and Configure a Kubernetes service account to assume an IAM role in the Amazon EKS User Guide and Configure service accounts for pods in the Kubernetes documentation .
- volumes
Specifies the volumes for a job definition that uses Amazon EKS resources.
ResourceRequirementProperty
- class CfnJobDefinition.ResourceRequirementProperty(*, type=None, value=None)
Bases:
object
The type and amount of a resource to assign to a container.
The supported resources include
GPU
,MEMORY
, andVCPU
.- Parameters:
type (
Optional
[str
]) – The type of resource to assign to a container. The supported resources includeGPU
,MEMORY
, andVCPU
.value (
Optional
[str
]) –The quantity of the specified resource to reserve for the container. The values vary based on the
type
specified. - type=”GPU” - The number of physical GPUs to reserve for the container. Make sure that the number of GPUs reserved for all containers in a job doesn’t exceed the number of available GPUs on the compute resource that the job is launched on. .. epigraph:: GPUs aren’t available for jobs that are running on Fargate resources. - type=”MEMORY” - The memory hard limit (in MiB) present to the container. This parameter is supported for jobs that are running on EC2 resources. If your container attempts to exceed the memory specified, the container is terminated. This parameter maps toMemory
in the Create a container section of the Docker Remote API and the--memory
option to docker run . You must specify at least 4 MiB of memory for a job. This is required but can be specified in several places for multi-node parallel (MNP) jobs. It must be specified for each node at least once. This parameter maps toMemory
in the Create a container section of the Docker Remote API and the--memory
option to docker run . .. epigraph:: If you’re trying to maximize your resource utilization by providing your jobs as much memory as possible for a particular instance type, see Memory management in the AWS Batch User Guide . For jobs that are running on Fargate resources, thenvalue
is the hard limit (in MiB), and must match one of the supported values and theVCPU
values must be one of the values supported for that memory value. - value = 512 -VCPU
= 0.25 - value = 1024 -VCPU
= 0.25 or 0.5 - value = 2048 -VCPU
= 0.25, 0.5, or 1 - value = 3072 -VCPU
= 0.5, or 1 - value = 4096 -VCPU
= 0.5, 1, or 2 - value = 5120, 6144, or 7168 -VCPU
= 1 or 2 - value = 8192 -VCPU
= 1, 2, or 4 - value = 9216, 10240, 11264, 12288, 13312, 14336, or 15360 -VCPU
= 2 or 4 - value = 16384 -VCPU
= 2, 4, or 8 - value = 17408, 18432, 19456, 21504, 22528, 23552, 25600, 26624, 27648, 29696, or 30720 -VCPU
= 4 - value = 20480, 24576, or 28672 -VCPU
= 4 or 8 - value = 36864, 45056, 53248, or 61440 -VCPU
= 8 - value = 32768, 40960, 49152, or 57344 -VCPU
= 8 or 16 - value = 65536, 73728, 81920, 90112, 98304, 106496, 114688, or 122880 -VCPU
= 16 - type=”VCPU” - The number of vCPUs reserved for the container. This parameter maps toCpuShares
in the Create a container section of the Docker Remote API and the--cpu-shares
option to docker run . Each vCPU is equivalent to 1,024 CPU shares. For EC2 resources, you must specify at least one vCPU. This is required but can be specified in several places; it must be specified for each node at least once. The default for the Fargate On-Demand vCPU resource count quota is 6 vCPUs. For more information about Fargate quotas, see AWS Fargate quotas in the AWS General Reference . For jobs that are running on Fargate resources, thenvalue
must match one of the supported values and theMEMORY
values must be one of the values supported for thatVCPU
value. The supported values are 0.25, 0.5, 1, 2, 4, 8, and 16 - value = 0.25 -MEMORY
= 512, 1024, or 2048 - value = 0.5 -MEMORY
= 1024, 2048, 3072, or 4096 - value = 1 -MEMORY
= 2048, 3072, 4096, 5120, 6144, 7168, or 8192 - value = 2 -MEMORY
= 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, or 16384 - value = 4 -MEMORY
= 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 17408, 18432, 19456, 20480, 21504, 22528, 23552, 24576, 25600, 26624, 27648, 28672, 29696, or 30720 - value = 8 -MEMORY
= 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, or 61440 - value = 16 -MEMORY
= 32768, 40960, 49152, 57344, 65536, 73728, 81920, 90112, 98304, 106496, 114688, or 122880
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch resource_requirement_property = batch.CfnJobDefinition.ResourceRequirementProperty( type="type", value="value" )
Attributes
- type
The type of resource to assign to a container.
The supported resources include
GPU
,MEMORY
, andVCPU
.
- value
The quantity of the specified resource to reserve for the container. The values vary based on the
type
specified.type=”GPU” - The number of physical GPUs to reserve for the container. Make sure that the number of GPUs reserved for all containers in a job doesn’t exceed the number of available GPUs on the compute resource that the job is launched on.
GPUs aren’t available for jobs that are running on Fargate resources.
type=”MEMORY” - The memory hard limit (in MiB) present to the container. This parameter is supported for jobs that are running on EC2 resources. If your container attempts to exceed the memory specified, the container is terminated. This parameter maps to
Memory
in the Create a container section of the Docker Remote API and the--memory
option to docker run . You must specify at least 4 MiB of memory for a job. This is required but can be specified in several places for multi-node parallel (MNP) jobs. It must be specified for each node at least once. This parameter maps toMemory
in the Create a container section of the Docker Remote API and the--memory
option to docker run .
If you’re trying to maximize your resource utilization by providing your jobs as much memory as possible for a particular instance type, see Memory management in the AWS Batch User Guide .
For jobs that are running on Fargate resources, then
value
is the hard limit (in MiB), and must match one of the supported values and theVCPU
values must be one of the values supported for that memory value.value = 512 -
VCPU
= 0.25value = 1024 -
VCPU
= 0.25 or 0.5value = 2048 -
VCPU
= 0.25, 0.5, or 1value = 3072 -
VCPU
= 0.5, or 1value = 4096 -
VCPU
= 0.5, 1, or 2value = 5120, 6144, or 7168 -
VCPU
= 1 or 2value = 8192 -
VCPU
= 1, 2, or 4value = 9216, 10240, 11264, 12288, 13312, 14336, or 15360 -
VCPU
= 2 or 4value = 16384 -
VCPU
= 2, 4, or 8value = 17408, 18432, 19456, 21504, 22528, 23552, 25600, 26624, 27648, 29696, or 30720 -
VCPU
= 4value = 20480, 24576, or 28672 -
VCPU
= 4 or 8value = 36864, 45056, 53248, or 61440 -
VCPU
= 8value = 32768, 40960, 49152, or 57344 -
VCPU
= 8 or 16value = 65536, 73728, 81920, 90112, 98304, 106496, 114688, or 122880 -
VCPU
= 16type=”VCPU” - The number of vCPUs reserved for the container. This parameter maps to
CpuShares
in the Create a container section of the Docker Remote API and the--cpu-shares
option to docker run . Each vCPU is equivalent to 1,024 CPU shares. For EC2 resources, you must specify at least one vCPU. This is required but can be specified in several places; it must be specified for each node at least once.
The default for the Fargate On-Demand vCPU resource count quota is 6 vCPUs. For more information about Fargate quotas, see AWS Fargate quotas in the AWS General Reference .
For jobs that are running on Fargate resources, then
value
must match one of the supported values and theMEMORY
values must be one of the values supported for thatVCPU
value. The supported values are 0.25, 0.5, 1, 2, 4, 8, and 16value = 0.25 -
MEMORY
= 512, 1024, or 2048value = 0.5 -
MEMORY
= 1024, 2048, 3072, or 4096value = 1 -
MEMORY
= 2048, 3072, 4096, 5120, 6144, 7168, or 8192value = 2 -
MEMORY
= 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, or 16384value = 4 -
MEMORY
= 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 17408, 18432, 19456, 20480, 21504, 22528, 23552, 24576, 25600, 26624, 27648, 28672, 29696, or 30720value = 8 -
MEMORY
= 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, or 61440value = 16 -
MEMORY
= 32768, 40960, 49152, 57344, 65536, 73728, 81920, 90112, 98304, 106496, 114688, or 122880
ResourcesProperty
- class CfnJobDefinition.ResourcesProperty(*, limits=None, requests=None)
Bases:
object
- Parameters:
limits (
Optional
[Any
]) –CfnJobDefinition.ResourcesProperty.Limits
.requests (
Optional
[Any
]) –CfnJobDefinition.ResourcesProperty.Requests
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch # limits: Any # requests: Any resources_property = batch.CfnJobDefinition.ResourcesProperty( limits=limits, requests=requests )
Attributes
- limits
CfnJobDefinition.ResourcesProperty.Limits
.
- requests
CfnJobDefinition.ResourcesProperty.Requests
.
RetryStrategyProperty
- class CfnJobDefinition.RetryStrategyProperty(*, attempts=None, evaluate_on_exit=None)
Bases:
object
The retry strategy that’s associated with a job.
For more information, see Automated job retries in the AWS Batch User Guide .
- Parameters:
attempts (
Union
[int
,float
,None
]) – The number of times to move a job to theRUNNABLE
status. You can specify between 1 and 10 attempts. If the value ofattempts
is greater than one, the job is retried on failure the same number of attempts as the value.evaluate_on_exit (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,EvaluateOnExitProperty
,Dict
[str
,Any
]]],None
]) – Array of up to 5 objects that specify the conditions where jobs are retried or failed. If this parameter is specified, then theattempts
parameter must also be specified. If none of the listed conditions match, then the job is retried.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch retry_strategy_property = batch.CfnJobDefinition.RetryStrategyProperty( attempts=123, evaluate_on_exit=[batch.CfnJobDefinition.EvaluateOnExitProperty( action="action", # the properties below are optional on_exit_code="onExitCode", on_reason="onReason", on_status_reason="onStatusReason" )] )
Attributes
- attempts
The number of times to move a job to the
RUNNABLE
status.You can specify between 1 and 10 attempts. If the value of
attempts
is greater than one, the job is retried on failure the same number of attempts as the value.
- evaluate_on_exit
Array of up to 5 objects that specify the conditions where jobs are retried or failed.
If this parameter is specified, then the
attempts
parameter must also be specified. If none of the listed conditions match, then the job is retried.
SecretProperty
- class CfnJobDefinition.SecretProperty(*, name, value_from)
Bases:
object
An object that represents the secret to expose to your container.
Secrets can be exposed to a container in the following ways:
To inject sensitive data into your containers as environment variables, use the
secrets
container definition parameter.To reference sensitive information in the log configuration of a container, use the
secretOptions
container definition parameter.
For more information, see Specifying sensitive data in the AWS Batch User Guide .
- Parameters:
name (
str
) – The name of the secret.value_from (
str
) – The secret to expose to the container. The supported values are either the full Amazon Resource Name (ARN) of the AWS Secrets Manager secret or the full ARN of the parameter in the AWS Systems Manager Parameter Store. .. epigraph:: If the AWS Systems Manager Parameter Store parameter exists in the same Region as the job you’re launching, then you can use either the full Amazon Resource Name (ARN) or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch secret_property = batch.CfnJobDefinition.SecretProperty( name="name", value_from="valueFrom" )
Attributes
- name
The name of the secret.
- value_from
The secret to expose to the container.
The supported values are either the full Amazon Resource Name (ARN) of the AWS Secrets Manager secret or the full ARN of the parameter in the AWS Systems Manager Parameter Store. .. epigraph:
If the AWS Systems Manager Parameter Store parameter exists in the same Region as the job you're launching, then you can use either the full Amazon Resource Name (ARN) or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.
SecurityContextProperty
- class CfnJobDefinition.SecurityContextProperty(*, privileged=None, read_only_root_filesystem=None, run_as_group=None, run_as_non_root=None, run_as_user=None)
Bases:
object
- Parameters:
privileged (
Union
[bool
,IResolvable
,None
]) –CfnJobDefinition.SecurityContextProperty.Privileged
.read_only_root_filesystem (
Union
[bool
,IResolvable
,None
]) –CfnJobDefinition.SecurityContextProperty.ReadOnlyRootFilesystem
.run_as_group (
Union
[int
,float
,None
]) –CfnJobDefinition.SecurityContextProperty.RunAsGroup
.run_as_non_root (
Union
[bool
,IResolvable
,None
]) –CfnJobDefinition.SecurityContextProperty.RunAsNonRoot
.run_as_user (
Union
[int
,float
,None
]) –CfnJobDefinition.SecurityContextProperty.RunAsUser
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch security_context_property = batch.CfnJobDefinition.SecurityContextProperty( privileged=False, read_only_root_filesystem=False, run_as_group=123, run_as_non_root=False, run_as_user=123 )
Attributes
- privileged
CfnJobDefinition.SecurityContextProperty.Privileged
.
- read_only_root_filesystem
CfnJobDefinition.SecurityContextProperty.ReadOnlyRootFilesystem
.
- run_as_group
CfnJobDefinition.SecurityContextProperty.RunAsGroup
.
- run_as_non_root
CfnJobDefinition.SecurityContextProperty.RunAsNonRoot
.
- run_as_user
CfnJobDefinition.SecurityContextProperty.RunAsUser
.
TimeoutProperty
- class CfnJobDefinition.TimeoutProperty(*, attempt_duration_seconds=None)
Bases:
object
An object that represents a job timeout configuration.
- Parameters:
attempt_duration_seconds (
Union
[int
,float
,None
]) – The job timeout time (in seconds) that’s measured from the job attempt’sstartedAt
timestamp. After this time passes, AWS Batch terminates your jobs if they aren’t finished. The minimum value for the timeout is 60 seconds. For array jobs, the timeout applies to the child jobs, not to the parent array job. For multi-node parallel (MNP) jobs, the timeout applies to the whole job, not to the individual nodes.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch timeout_property = batch.CfnJobDefinition.TimeoutProperty( attempt_duration_seconds=123 )
Attributes
- attempt_duration_seconds
The job timeout time (in seconds) that’s measured from the job attempt’s
startedAt
timestamp.After this time passes, AWS Batch terminates your jobs if they aren’t finished. The minimum value for the timeout is 60 seconds.
For array jobs, the timeout applies to the child jobs, not to the parent array job.
For multi-node parallel (MNP) jobs, the timeout applies to the whole job, not to the individual nodes.
TmpfsProperty
- class CfnJobDefinition.TmpfsProperty(*, container_path, size, mount_options=None)
Bases:
object
The container path, mount options, and size of the
tmpfs
mount.This object isn’t applicable to jobs that are running on Fargate resources.
- Parameters:
container_path (
str
) – The absolute file path in the container where thetmpfs
volume is mounted.size (
Union
[int
,float
]) – The size (in MiB) of thetmpfs
volume.mount_options (
Optional
[Sequence
[str
]]) – The list oftmpfs
volume mount options. Valid values: “defaults
“ | “ro
“ | “rw
“ | “suid
“ | “nosuid
“ | “dev
“ | “nodev
“ | “exec
“ | “noexec
“ | “sync
“ | “async
“ | “dirsync
“ | “remount
“ | “mand
“ | “nomand
“ | “atime
“ | “noatime
“ | “diratime
“ | “nodiratime
“ | “bind
“ | “rbind" | "unbindable" | "runbindable" | "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave" | "relatime
“ | “norelatime
“ | “strictatime
“ | “nostrictatime
“ | “mode
“ | “uid
“ | “gid
“ | “nr_inodes
“ | “nr_blocks
“ | “mpol
“
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch tmpfs_property = batch.CfnJobDefinition.TmpfsProperty( container_path="containerPath", size=123, # the properties below are optional mount_options=["mountOptions"] )
Attributes
- container_path
The absolute file path in the container where the
tmpfs
volume is mounted.
- mount_options
The list of
tmpfs
volume mount options.Valid values: “
defaults
“ | “ro
“ | “rw
“ | “suid
“ | “nosuid
“ | “dev
“ | “nodev
“ | “exec
“ | “noexec
“ | “sync
“ | “async
“ | “dirsync
“ | “remount
“ | “mand
“ | “nomand
“ | “atime
“ | “noatime
“ | “diratime
“ | “nodiratime
“ | “bind
“ | “rbind" | "unbindable" | "runbindable" | "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave" | "relatime
“ | “norelatime
“ | “strictatime
“ | “nostrictatime
“ | “mode
“ | “uid
“ | “gid
“ | “nr_inodes
“ | “nr_blocks
“ | “mpol
“
- size
The size (in MiB) of the
tmpfs
volume.
UlimitProperty
- class CfnJobDefinition.UlimitProperty(*, hard_limit, name, soft_limit)
Bases:
object
The
ulimit
settings to pass to the container.This object isn’t applicable to jobs that are running on Fargate resources.
- Parameters:
hard_limit (
Union
[int
,float
]) – The hard limit for theulimit
type.name (
str
) – Thetype
of theulimit
.soft_limit (
Union
[int
,float
]) – The soft limit for theulimit
type.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch ulimit_property = batch.CfnJobDefinition.UlimitProperty( hard_limit=123, name="name", soft_limit=123 )
Attributes
- hard_limit
The hard limit for the
ulimit
type.
- name
The
type
of theulimit
.
- soft_limit
The soft limit for the
ulimit
type.
VolumesHostProperty
- class CfnJobDefinition.VolumesHostProperty(*, source_path=None)
Bases:
object
Determine whether your data volume persists on the host container instance and where it’s stored.
If this parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn’t guaranteed to persist after the containers that are associated with it stop running.
- Parameters:
source_path (
Optional
[str
]) – The path on the host container instance that’s presented to the container. If this parameter is empty, then the Docker daemon has assigned a host path for you. If this parameter contains a file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the source path location doesn’t exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported. .. epigraph:: This parameter isn’t applicable to jobs that run on Fargate resources. Don’t provide this for these jobs.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch volumes_host_property = batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" )
Attributes
- source_path
The path on the host container instance that’s presented to the container.
If this parameter is empty, then the Docker daemon has assigned a host path for you. If this parameter contains a file location, then the data volume persists at the specified location on the host container instance until you delete it manually. If the source path location doesn’t exist on the host container instance, the Docker daemon creates it. If the location does exist, the contents of the source path folder are exported. .. epigraph:
This parameter isn't applicable to jobs that run on Fargate resources. Don't provide this for these jobs.
VolumesProperty
- class CfnJobDefinition.VolumesProperty(*, efs_volume_configuration=None, host=None, name=None)
Bases:
object
A list of volumes that are associated with the job.
- Parameters:
efs_volume_configuration (
Union
[IResolvable
,EfsVolumeConfigurationProperty
,Dict
[str
,Any
],None
]) –This is used when you’re using an Amazon Elastic File System file system for job storage. For more information, see Amazon EFS Volumes in the AWS Batch User Guide .
host (
Union
[IResolvable
,VolumesHostProperty
,Dict
[str
,Any
],None
]) – The contents of thehost
parameter determine whether your data volume persists on the host container instance and where it’s stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn’t guaranteed to persist after the containers that are associated with it stop running. .. epigraph:: This parameter isn’t applicable to jobs that are running on Fargate resources and shouldn’t be provided.name (
Optional
[str
]) – The name of the volume. It can be up to 255 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_). This name is referenced in thesourceVolume
parameter of container definitionmountPoints
.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_batch as batch volumes_property = batch.CfnJobDefinition.VolumesProperty( efs_volume_configuration=batch.CfnJobDefinition.EfsVolumeConfigurationProperty( file_system_id="fileSystemId", # the properties below are optional authorization_config=batch.CfnJobDefinition.AuthorizationConfigProperty( access_point_id="accessPointId", iam="iam" ), root_directory="rootDirectory", transit_encryption="transitEncryption", transit_encryption_port=123 ), host=batch.CfnJobDefinition.VolumesHostProperty( source_path="sourcePath" ), name="name" )
Attributes
- efs_volume_configuration
This is used when you’re using an Amazon Elastic File System file system for job storage.
For more information, see Amazon EFS Volumes in the AWS Batch User Guide .
- host
The contents of the
host
parameter determine whether your data volume persists on the host container instance and where it’s stored.If the host parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn’t guaranteed to persist after the containers that are associated with it stop running. .. epigraph:
This parameter isn't applicable to jobs that are running on Fargate resources and shouldn't be provided.
- name
The name of the volume.
It can be up to 255 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_). This name is referenced in the
sourceVolume
parameter of container definitionmountPoints
.