aws-cdk-lib.aws_ecs.CloudMapOptions

interface CloudMapOptions

LanguageType name
.NETAmazon.CDK.AWS.ECS.CloudMapOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#CloudMapOptions
Javasoftware.amazon.awscdk.services.ecs.CloudMapOptions
Pythonaws_cdk.aws_ecs.CloudMapOptions
TypeScript (source)aws-cdk-lib » aws_ecs » CloudMapOptions

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

Example

declare const taskDefinition: ecs.TaskDefinition;
declare const cluster: ecs.Cluster;

const service = new ecs.Ec2Service(this, 'Service', {
  cluster,
  taskDefinition,
  cloudMapOptions: {
    // Create A records - useful for AWSVPC network mode.
    dnsRecordType: cloudmap.DnsRecordType.A,
  },
});

Properties

NameTypeDescription
cloudMapNamespace?INamespaceThe service discovery namespace for the Cloud Map service to attach to the ECS service.
container?ContainerDefinitionThe container to point to for a SRV record.
containerPort?numberThe port to point to for a SRV record.
dnsRecordType?DnsRecordTypeThe DNS record type that you want AWS Cloud Map to create.
dnsTtl?DurationThe amount of time that you want DNS resolvers to cache the settings for this record.
failureThreshold?numberThe 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.
name?stringThe name of the Cloud Map service to attach to the ECS service.

cloudMapNamespace?

Type: INamespace (optional, default: the defaultCloudMapNamespace associated to the cluster)

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


container?

Type: ContainerDefinition (optional, default: the task definition's default container)

The container to point to for a SRV record.


containerPort?

Type: number (optional, default: the default port of the task definition's default container)

The port to point to for a SRV record.


dnsRecordType?

Type: DnsRecordType (optional, default: DnsRecordType.A if TaskDefinition.networkMode = AWS_VPC, otherwise DnsRecordType.SRV)

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

The supported record types are A or SRV.


dnsTtl?

Type: Duration (optional, default: Duration.minutes(1))

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


failureThreshold?

Type: number (optional)

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?

Type: string (optional, default: CloudFormation-generated name)

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