# FargateServiceAttributes

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

- Source: [`aws-ecs/lib/fargate/fargate-service.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-service.ts#L92)
- Type last changed: v2.60.0 · 12 Jan 2023

## 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

- `cluster`: [ICluster](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ICluster.html) (required) — The cluster that hosts the service.

- `serviceArn`: string = either this, or `serviceName`, is required — The service ARN.

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

- `serviceName`: string = either this, or `serviceArn`, is required — The name of the service.

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