# CloudMapOptions

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

- Source: [`aws-ecs/lib/base/base-service.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts#L2044)

## Example

```ts
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

- `cloudMapNamespace`: [INamespace](/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.INamespace.html) — The service discovery namespace for the Cloud Map service to attach to the ECS service.

  **Default:** the defaultCloudMapNamespace associated to the cluster

- `container`: [ContainerDefinition](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ContainerDefinition.html) — The container to point to for a SRV record.

  **Default:** the task definition's default container

- `containerPort`: number — The port to point to for a SRV record.

  **Default:** the default port of the task definition's default container

- `dnsRecordType`: [DnsRecordType](/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.DnsRecordType.html) — The DNS record type that you want AWS Cloud Map to create.

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

  The supported record types are A or SRV.

- `dnsTtl`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(1) — The amount of time that you want DNS resolvers to cache the settings for this record.

- `failureThreshold`: number — 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`: string — The name of the Cloud Map service to attach to the ECS service.

  **Default:** CloudFormation-generated name
