Ec2ServiceAttributes
- class aws_cdk.aws_ecs.Ec2ServiceAttributes(*, cluster, service_arn=None, service_name=None)
Bases:
objectThe properties to import from the service using the EC2 launch type.
- Parameters:
cluster (
ICluster) – The cluster that hosts the service.service_arn (
Optional[str]) – The service ARN. Default: - either this, orserviceName, is requiredservice_name (
Optional[str]) – The name of the service. Default: - either this, orserviceArn, is required
- ExampleMetadata:
infused
Example:
# cluster: ecs.Cluster # Import service from EC2 service attributes ec2_service_from_attributes = ecs.Ec2Service.from_ec2_service_attributes(self, "Ec2ServiceFromAttributes", service_arn="arn:aws:ecs:us-west-2:123456789012:service/my-http-service", cluster=cluster ) # Import service from EC2 service ARN ec2_service_from_arn = ecs.Ec2Service.from_ec2_service_arn(self, "Ec2ServiceFromArn", "arn:aws:ecs:us-west-2:123456789012:service/my-http-service") # Import service from Fargate service attributes fargate_service_from_attributes = ecs.FargateService.from_fargate_service_attributes(self, "FargateServiceFromAttributes", service_arn="arn:aws:ecs:us-west-2:123456789012:service/my-http-service", cluster=cluster ) # Import service from Fargate service ARN fargate_service_from_arn = ecs.FargateService.from_fargate_service_arn(self, "FargateServiceFromArn", "arn:aws:ecs:us-west-2:123456789012:service/my-http-service")
Attributes
- cluster
The cluster that hosts the service.
- service_arn
The service ARN.
- Default:
either this, or
serviceName, is required
- service_name
The name of the service.
- Default:
either this, or
serviceArn, is required