DomainJoinedCredentialSpec

class aws_cdk.aws_ecs.DomainJoinedCredentialSpec(file_location)

Bases: CredentialSpec

Credential specification (CredSpec) file.

ExampleMetadata:

infused

Example:

# Make sure the task definition's execution role has permissions to read from the S3 bucket or SSM parameter where the CredSpec file is stored.
# parameter: ssm.IParameter
# task_definition: ecs.TaskDefinition


# Domain-joined gMSA container from a SSM parameter
task_definition.add_container("gmsa-domain-joined-container",
    image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
    cpu=128,
    memory_limit_mi_b=256,
    credential_specs=[ecs.DomainJoinedCredentialSpec.from_ssm_parameter(parameter)]
)
Parameters:

file_location (str) – Location or ARN from where to retrieve the CredSpec file.

Methods

bind()

Called when the container is initialized to allow this object to bind to the stack.

Return type:

CredentialSpecConfig

Attributes

file_location

Location or ARN from where to retrieve the CredSpec file.

prefix_id

Prefix string based on the type of CredSpec.

Static Methods

classmethod arn_for_s3_object(bucket, key)

Helper method to generate the ARN for a S3 object.

Used to avoid duplication of logic in derived classes.

Parameters:
  • bucket (IBucket) –

  • key (str) –

Return type:

str

classmethod arn_for_ssm_parameter(parameter)

Helper method to generate the ARN for a SSM parameter.

Used to avoid duplication of logic in derived classes.

Parameters:

parameter (IParameter) –

Return type:

str

classmethod from_s3_bucket(bucket, key)

Loads the CredSpec from a S3 bucket object.

Parameters:
  • bucket (IBucket) – The S3 bucket.

  • key (str) – The object key.

Return type:

DomainJoinedCredentialSpec

Returns:

CredSpec with it’s locations set to the S3 object’s ARN.

classmethod from_ssm_parameter(parameter)

Loads the CredSpec from a SSM parameter.

Parameters:

parameter (IParameter) – The SSM parameter.

Return type:

DomainJoinedCredentialSpec

Returns:

CredSpec with it’s locations set to the SSM parameter’s ARN.