Interface Ec2ServiceAttributes

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
Ec2ServiceAttributes.Jsii$Proxy

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-08-27T15:24:24.537Z") @Stability(Stable) public interface Ec2ServiceAttributes extends software.amazon.jsii.JsiiSerializable
The properties to import from the service using the EC2 launch type.

Example:

 Cluster cluster;
 // Import service from EC2 service attributes
 IBaseService ec2ServiceFromAttributes = Ec2Service.fromEc2ServiceAttributes(this, "Ec2ServiceFromAttributes", Ec2ServiceAttributes.builder()
         .serviceArn("arn:aws:ecs:us-west-2:123456789012:service/my-http-service")
         .cluster(cluster)
         .build());
 // Import service from EC2 service ARN
 IEc2Service ec2ServiceFromArn = Ec2Service.fromEc2ServiceArn(this, "Ec2ServiceFromArn", "arn:aws:ecs:us-west-2:123456789012:service/my-http-service");
 // Import service from Fargate service attributes
 IBaseService fargateServiceFromAttributes = FargateService.fromFargateServiceAttributes(this, "FargateServiceFromAttributes", FargateServiceAttributes.builder()
         .serviceArn("arn:aws:ecs:us-west-2:123456789012:service/my-http-service")
         .cluster(cluster)
         .build());
 // Import service from Fargate service ARN
 IFargateService fargateServiceFromArn = FargateService.fromFargateServiceArn(this, "FargateServiceFromArn", "arn:aws:ecs:us-west-2:123456789012:service/my-http-service");
 
  • Method Details

    • getCluster

      @Stability(Stable) @NotNull ICluster getCluster()
      The cluster that hosts the service.
    • getServiceArn

      @Stability(Stable) @Nullable default String getServiceArn()
      The service ARN.

      Default: - either this, or `serviceName`, is required

    • getServiceName

      @Stability(Stable) @Nullable default String getServiceName()
      The name of the service.

      Default: - either this, or `serviceArn`, is required

    • builder

      @Stability(Stable) static Ec2ServiceAttributes.Builder builder()
      Returns:
      a Ec2ServiceAttributes.Builder of Ec2ServiceAttributes