CloudMapOptions

class aws_cdk.aws_ecs.CloudMapOptions(*, cloud_map_namespace=None, container=None, container_port=None, dns_record_type=None, dns_ttl=None, failure_threshold=None, name=None)

Bases: object

The options to enabling AWS Cloud Map for an Amazon ECS service.

Parameters:
  • cloud_map_namespace (Optional[INamespace]) – The service discovery namespace for the Cloud Map service to attach to the ECS service. Default: - the defaultCloudMapNamespace associated to the cluster

  • container (Optional[ContainerDefinition]) – The container to point to for a SRV record. Default: - the task definition’s default container

  • container_port (Union[int, float, None]) – The port to point to for a SRV record. Default: - the default port of the task definition’s default container

  • dns_record_type (Optional[DnsRecordType]) – The DNS record type that you want AWS Cloud Map to create. The supported record types are A or SRV. Default: - DnsRecordType.A if TaskDefinition.networkMode = AWS_VPC, otherwise DnsRecordType.SRV

  • dns_ttl (Optional[Duration]) – The amount of time that you want DNS resolvers to cache the settings for this record. Default: Duration.minutes(1)

  • failure_threshold (Union[int, float, None]) – The number of 30-second intervals that you want Cloud Map to wait after receiving an UpdateInstanceCustomHealthStatus request before it changes the health status of a service instance. NOTE: This is used for HealthCheckCustomConfig

  • name (Optional[str]) – The name of the Cloud Map service to attach to the ECS service. Default: CloudFormation-generated name

ExampleMetadata:

infused

Example:

# task_definition: ecs.TaskDefinition
# cluster: ecs.Cluster


service = ecs.Ec2Service(self, "Service",
    cluster=cluster,
    task_definition=task_definition,
    cloud_map_options=ecs.CloudMapOptions(
        # Create A records - useful for AWSVPC network mode.
        dns_record_type=cloudmap.DnsRecordType.A
    )
)

Attributes

cloud_map_namespace

The service discovery namespace for the Cloud Map service to attach to the ECS service.

Default:
  • the defaultCloudMapNamespace associated to the cluster

container

The container to point to for a SRV record.

Default:
  • the task definition’s default container

container_port

The port to point to for a SRV record.

Default:
  • the default port of the task definition’s default container

dns_record_type

The DNS record type that you want AWS Cloud Map to create.

The supported record types are A or SRV.

Default:
  • DnsRecordType.A if TaskDefinition.networkMode = AWS_VPC, otherwise DnsRecordType.SRV

dns_ttl

The amount of time that you want DNS resolvers to cache the settings for this record.

Default:

Duration.minutes(1)

failure_threshold

The number of 30-second intervals that you want Cloud Map to wait after receiving an UpdateInstanceCustomHealthStatus request before it changes the health status of a service instance.

NOTE: This is used for HealthCheckCustomConfig

name

The name of the Cloud Map service to attach to the ECS service.

Default:

CloudFormation-generated name