Skip to content
v2.273.0

FargateServiceAttributes Struct ​

The properties to import from the service using the Fargate launch type.

Example ​

ts
declare const cluster: ecs.Cluster;

// Import service from EC2 service attributes
const ec2ServiceFromAttributes = ecs.Ec2Service.fromEc2ServiceAttributes(this, 'Ec2ServiceFromAttributes', {
  serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service',
  cluster,
});

// Import service from EC2 service ARN
const ec2ServiceFromArn = ecs.Ec2Service.fromEc2ServiceArn(this, 'Ec2ServiceFromArn', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service');

// Import service from Fargate service attributes
const fargateServiceFromAttributes = ecs.FargateService.fromFargateServiceAttributes(this, 'FargateServiceFromAttributes', {
  serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service',
  cluster,
});

// Import service from Fargate service ARN
const fargateServiceFromArn = ecs.FargateService.fromFargateServiceArn(this, 'FargateServiceFromArn', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service');

Properties ​

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster that hosts the service.
serviceArnstringservice_arnstrserviceArnStringServiceArnstringServiceArn*string= either this, or `serviceName`, i…#
The service ARN.
default

Default: either this, or serviceName, is required

serviceNamestringservice_namestrserviceNameStringServiceNamestringServiceName*string= either this, or `serviceArn`, is…#
The name of the service.
default

Default: either this, or serviceArn, is required