aws-cdk-lib.aws_ecs_patterns.NetworkMultipleTargetGroupsServiceBaseProps

interface NetworkMultipleTargetGroupsServiceBaseProps

LanguageType name
.NETAmazon.CDK.AWS.ECS.Patterns.NetworkMultipleTargetGroupsServiceBaseProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecspatterns#NetworkMultipleTargetGroupsServiceBaseProps
Javasoftware.amazon.awscdk.services.ecs.patterns.NetworkMultipleTargetGroupsServiceBaseProps
Pythonaws_cdk.aws_ecs_patterns.NetworkMultipleTargetGroupsServiceBaseProps
TypeScript (source)aws-cdk-lib » aws_ecs_patterns » NetworkMultipleTargetGroupsServiceBaseProps

The properties for the base NetworkMultipleTargetGroupsEc2Service or NetworkMultipleTargetGroupsFargateService service.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_ecs_patterns as ecs_patterns } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_route53 as route53 } from 'aws-cdk-lib';
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';

declare const cluster: ecs.Cluster;
declare const containerDefinition: ecs.ContainerDefinition;
declare const containerImage: ecs.ContainerImage;
declare const hostedZone: route53.HostedZone;
declare const logDriver: ecs.LogDriver;
declare const namespace: servicediscovery.INamespace;
declare const role: iam.Role;
declare const secret: ecs.Secret;
declare const vpc: ec2.Vpc;
const networkMultipleTargetGroupsServiceBaseProps: ecs_patterns.NetworkMultipleTargetGroupsServiceBaseProps = {
  cloudMapOptions: {
    cloudMapNamespace: namespace,
    container: containerDefinition,
    containerPort: 123,
    dnsRecordType: servicediscovery.DnsRecordType.A,
    dnsTtl: cdk.Duration.minutes(30),
    failureThreshold: 123,
    name: 'name',
  },
  cluster: cluster,
  desiredCount: 123,
  enableECSManagedTags: false,
  enableExecuteCommand: false,
  healthCheckGracePeriod: cdk.Duration.minutes(30),
  loadBalancers: [{
    listeners: [{
      name: 'name',

      // the properties below are optional
      port: 123,
    }],
    name: 'name',

    // the properties below are optional
    domainName: 'domainName',
    domainZone: hostedZone,
    publicLoadBalancer: false,
  }],
  propagateTags: ecs.PropagatedTagSource.SERVICE,
  serviceName: 'serviceName',
  targetGroups: [{
    containerPort: 123,

    // the properties below are optional
    listener: 'listener',
  }],
  taskImageOptions: {
    image: containerImage,

    // the properties below are optional
    containerName: 'containerName',
    containerPorts: [123],
    dockerLabels: {
      dockerLabelsKey: 'dockerLabels',
    },
    enableLogging: false,
    environment: {
      environmentKey: 'environment',
    },
    executionRole: role,
    family: 'family',
    logDriver: logDriver,
    secrets: {
      secretsKey: secret,
    },
    taskRole: role,
  },
  vpc: vpc,
};

Properties

NameTypeDescription
cloudMapOptions?CloudMapOptionsThe options for configuring an Amazon ECS service to use service discovery.
cluster?IClusterThe name of the cluster that hosts the service.
desiredCount?numberThe desired number of instantiations of the task definition to keep running on the service.
enableECSManagedTags?booleanSpecifies whether to enable Amazon ECS managed tags for the tasks within the service.
enableExecuteCommand?booleanWhether ECS Exec should be enabled.
healthCheckGracePeriod?DurationThe period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.
loadBalancers?NetworkLoadBalancerProps[]The network load balancer that will serve traffic to the service.
propagateTags?PropagatedTagSourceSpecifies whether to propagate the tags from the task definition or the service to the tasks in the service.
serviceName?stringName of the service.
targetGroups?NetworkTargetProps[]Properties to specify NLB target groups.
taskImageOptions?NetworkLoadBalancedTaskImagePropsThe properties required to create a new task definition.
vpc?IVpcThe VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

cloudMapOptions?

Type: CloudMapOptions (optional, default: AWS Cloud Map service discovery is not enabled.)

The options for configuring an Amazon ECS service to use service discovery.


cluster?

Type: ICluster (optional, default: create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.)

The name of the cluster that hosts the service.

If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.


desiredCount?

Type: number (optional, default: If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; if true, the default is 1 for all new services and uses the existing services desired count when updating an existing service.)

The desired number of instantiations of the task definition to keep running on the service.

The minimum value is 1


enableECSManagedTags?

Type: boolean (optional, default: false)

Specifies whether to enable Amazon ECS managed tags for the tasks within the service.

For more information, see Tagging Your Amazon ECS Resources


enableExecuteCommand?

Type: boolean (optional, default: false)

Whether ECS Exec should be enabled.


healthCheckGracePeriod?

Type: Duration (optional, default: defaults to 60 seconds if at least one load balancer is in-use and it is not already set)

The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.


loadBalancers?

Type: NetworkLoadBalancerProps[] (optional, default: a new load balancer with a listener will be created.)

The network load balancer that will serve traffic to the service.


propagateTags?

Type: PropagatedTagSource (optional, default: none)

Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

Tags can only be propagated to the tasks within the service during service creation.


serviceName?

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

Name of the service.


targetGroups?

Type: NetworkTargetProps[] (optional, default: default portMapping registered as target group and attached to the first defined listener)

Properties to specify NLB target groups.


taskImageOptions?

Type: NetworkLoadBalancedTaskImageProps (optional, default: none)

The properties required to create a new task definition.

Only one of TaskDefinition or TaskImageOptions must be specified.


vpc?

Type: IVpc (optional, default: uses the VPC defined in the cluster or creates a new VPC.)

The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.