# API Reference ## Constructs ### Environment - *Implements:* IEnvironment An environment into which to deploy a service. This environment can either be instantiated with a pre-existing AWS VPC and ECS cluster, or it can create its own VPC and cluster. By default, it will create a cluster with Fargate capacity. #### Initializers ```typescript import { Environment } from '@aws-cdk-containers/ecs-service-extensions' new Environment(scope: Construct, id: string, props?: EnvironmentProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | EnvironmentProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Optional - *Type:* EnvironmentProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | addDefaultCloudMapNamespace | Add a default cloudmap namespace to the environment's cluster. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `addDefaultCloudMapNamespace` ```typescript public addDefaultCloudMapNamespace(options: CloudMapNamespaceOptions): void ``` Add a default cloudmap namespace to the environment's cluster. The environment's cluster must not be imported. ###### `options`Required - *Type:* aws-cdk-lib.aws_ecs.CloudMapNamespaceOptions --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | | fromEnvironmentAttributes | Import an existing environment from its attributes. | --- ##### ~~`isConstruct`~~ ```typescript import { Environment } from '@aws-cdk-containers/ecs-service-extensions' Environment.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- ##### `fromEnvironmentAttributes` ```typescript import { Environment } from '@aws-cdk-containers/ecs-service-extensions' Environment.fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes) ``` Import an existing environment from its attributes. ###### `scope`Required - *Type:* constructs.Construct --- ###### `id`Required - *Type:* string --- ###### `attrs`Required - *Type:* EnvironmentAttributes --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | capacityType | EnvironmentCapacityType | The capacity type used by the service's cluster. | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster that is providing capacity for this service. | | id | string | The name of this environment. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC where environment services should be placed. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `capacityType`Required ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType The capacity type used by the service's cluster. --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster that is providing capacity for this service. --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string The name of this environment. --- ##### `vpc`Required ```typescript public readonly vpc: IVpc; ``` - *Type:* aws-cdk-lib.aws_ec2.IVpc The VPC where environment services should be placed. --- ### ImportedEnvironment - *Implements:* IEnvironment #### Initializers ```typescript import { ImportedEnvironment } from '@aws-cdk-containers/ecs-service-extensions' new ImportedEnvironment(scope: Construct, id: string, props: EnvironmentAttributes) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | EnvironmentAttributes | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* EnvironmentAttributes --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | addDefaultCloudMapNamespace | Adding a default cloudmap namespace to the cluster will throw an error, as we don't own it. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `addDefaultCloudMapNamespace` ```typescript public addDefaultCloudMapNamespace(_options: CloudMapNamespaceOptions): void ``` Adding a default cloudmap namespace to the cluster will throw an error, as we don't own it. ###### `_options`Required - *Type:* aws-cdk-lib.aws_ecs.CloudMapNamespaceOptions --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### ~~`isConstruct`~~ ```typescript import { ImportedEnvironment } from '@aws-cdk-containers/ecs-service-extensions' ImportedEnvironment.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | capacityType | EnvironmentCapacityType | The capacity type used by the service's cluster. | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster that is providing capacity for this service. | | id | string | The name of this environment. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC into which environment services should be placed. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `capacityType`Required ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType The capacity type used by the service's cluster. --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster that is providing capacity for this service. --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string The name of this environment. --- ##### `vpc`Required ```typescript public readonly vpc: IVpc; ``` - *Type:* aws-cdk-lib.aws_ec2.IVpc The VPC into which environment services should be placed. --- ### Service This Service construct serves as a Builder class for an ECS service. It supports various extensions and keeps track of any mutating state, allowing it to build up an ECS service progressively. #### Initializers ```typescript import { Service } from '@aws-cdk-containers/ecs-service-extensions' new Service(scope: Construct, id: string, props: ServiceProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | ServiceProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* ServiceProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | addURL | This method adds a new URL for the service. | | connectTo | Tell extensions from one service to connect to extensions from another sevice if they have implemented a hook for it. | | enableAutoScalingPolicy | This helper method is used to set the `autoScalingPoliciesEnabled` attribute whenever an auto scaling policy is configured for the service. | | getURL | Retrieve a URL for the service. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `addURL` ```typescript public addURL(urlName: string, url: string): void ``` This method adds a new URL for the service. This allows extensions to submit a URL for the service. For example, a load balancer might add its URL, or App Mesh can add its DNS name for the service. ###### `urlName`Required - *Type:* string The identifier name for this URL. --- ###### `url`Required - *Type:* string The URL itself. --- ##### `connectTo` ```typescript public connectTo(service: Service, connectToProps?: ConnectToProps): void ``` Tell extensions from one service to connect to extensions from another sevice if they have implemented a hook for it. ###### `service`Required - *Type:* Service --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `enableAutoScalingPolicy` ```typescript public enableAutoScalingPolicy(): void ``` This helper method is used to set the `autoScalingPoliciesEnabled` attribute whenever an auto scaling policy is configured for the service. ##### `getURL` ```typescript public getURL(urlName: string): string ``` Retrieve a URL for the service. The URL must have previously been stored by one of the URL providing extensions. ###### `urlName`Required - *Type:* string The URL to look up. --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### ~~`isConstruct`~~ ```typescript import { Service } from '@aws-cdk-containers/ecs-service-extensions' Service.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | capacityType | EnvironmentCapacityType | The capacity type that this service will use. | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster that is providing capacity for this service. | | environment | IEnvironment | The environment where this service was launched. | | id | string | The name of the service. | | serviceDescription | ServiceDescription | The ServiceDescription used to build this service. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC where this service should be placed. | | scalableTaskCount | aws-cdk-lib.aws_ecs.ScalableTaskCount | The scalable attribute representing task count. | | ecsService | aws-cdk-lib.aws_ecs.Ec2Service \| aws-cdk-lib.aws_ecs.FargateService | The underlying ECS service that was created. | | targetGroup | aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroup | The application target group if the service has an HTTPLoadBalancerExtension. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `capacityType`Required ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType The capacity type that this service will use. Valid values are EC2 or FARGATE. --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster that is providing capacity for this service. [disable-awslint:ref-via-interface] --- ##### `environment`Required ```typescript public readonly environment: IEnvironment; ``` - *Type:* IEnvironment The environment where this service was launched. --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string The name of the service. --- ##### `serviceDescription`Required ```typescript public readonly serviceDescription: ServiceDescription; ``` - *Type:* ServiceDescription The ServiceDescription used to build this service. --- ##### `vpc`Required ```typescript public readonly vpc: IVpc; ``` - *Type:* aws-cdk-lib.aws_ec2.IVpc The VPC where this service should be placed. --- ##### `scalableTaskCount`Optional ```typescript public readonly scalableTaskCount: ScalableTaskCount; ``` - *Type:* aws-cdk-lib.aws_ecs.ScalableTaskCount The scalable attribute representing task count. --- ##### `ecsService`Required ```typescript public readonly ecsService: Ec2Service | FargateService; ``` - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The underlying ECS service that was created. --- ##### `targetGroup`Optional ```typescript public readonly targetGroup: ApplicationTargetGroup; ``` - *Type:* aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroup The application target group if the service has an HTTPLoadBalancerExtension. --- ## Structs ### AliasedPortMutatingHookProps #### Initializer ```typescript import { AliasedPortMutatingHookProps } from '@aws-cdk-containers/ecs-service-extensions' const aliasedPortMutatingHookProps: AliasedPortMutatingHookProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | aliasPort | number | The port on the container which receives traffic. | | portMappingName | string | The name by which to refer to this port mapping. | | protocol | aws-cdk-lib.aws_ecs.AppProtocol | The protocol which this port mapping expects to receive. | --- ##### `aliasPort`Required ```typescript public readonly aliasPort: number; ``` - *Type:* number The port on the container which receives traffic. This is the same as the `containerPort` property of port mapping. --- ##### `portMappingName`Required ```typescript public readonly portMappingName: string; ``` - *Type:* string The name by which to refer to this port mapping. --- ##### `protocol`Optional ```typescript public readonly protocol: AppProtocol; ``` - *Type:* aws-cdk-lib.aws_ecs.AppProtocol - *Default:* none The protocol which this port mapping expects to receive. --- ### AliasedPortProps AliasedPortProps defines the properties of an aliased port extension. #### Initializer ```typescript import { AliasedPortProps } from '@aws-cdk-containers/ecs-service-extensions' const aliasedPortProps: AliasedPortProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | alias | string | The DNS alias to advertise for downstream clients. | | aliasPort | number | The traffic port for clients to use to connect to the DNS alias. | | appProtocol | aws-cdk-lib.aws_ecs.AppProtocol | The protocol to use over the specified port. | --- ##### `alias`Required ```typescript public readonly alias: string; ``` - *Type:* string The DNS alias to advertise for downstream clients. --- ##### `aliasPort`Optional ```typescript public readonly aliasPort: number; ``` - *Type:* number - *Default:* same as containerPort. The traffic port for clients to use to connect to the DNS alias. --- ##### `appProtocol`Optional ```typescript public readonly appProtocol: AppProtocol; ``` - *Type:* aws-cdk-lib.aws_ecs.AppProtocol - *Default:* none The protocol to use over the specified port. May be one of HTTP, HTTP2, or GRPC. --- ### AssignPublicIpDnsOptions #### Initializer ```typescript import { AssignPublicIpDnsOptions } from '@aws-cdk-containers/ecs-service-extensions' const assignPublicIpDnsOptions: AssignPublicIpDnsOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | recordName | string | Name of the record to add to the zone and in which to add the task IP addresses to. | | zone | aws-cdk-lib.aws_route53.IHostedZone | A DNS Zone to expose task IPs in. | --- ##### `recordName`Required ```typescript public readonly recordName: string; ``` - *Type:* string Name of the record to add to the zone and in which to add the task IP addresses to. --- *Example* ```typescript 'myservice' ``` ##### `zone`Required ```typescript public readonly zone: IHostedZone; ``` - *Type:* aws-cdk-lib.aws_route53.IHostedZone A DNS Zone to expose task IPs in. --- ### AssignPublicIpExtensionOptions #### Initializer ```typescript import { AssignPublicIpExtensionOptions } from '@aws-cdk-containers/ecs-service-extensions' const assignPublicIpExtensionOptions: AssignPublicIpExtensionOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | dns | AssignPublicIpDnsOptions | Enable publishing task public IPs to a recordset in a Route 53 hosted zone. | --- ##### `dns`Optional ```typescript public readonly dns: AssignPublicIpDnsOptions; ``` - *Type:* AssignPublicIpDnsOptions Enable publishing task public IPs to a recordset in a Route 53 hosted zone. Note: If you want to change the DNS zone or record name, you will need to remove this extension completely and then re-add it. --- ### AutoScalingOptions #### Initializer ```typescript import { AutoScalingOptions } from '@aws-cdk-containers/ecs-service-extensions' const autoScalingOptions: AutoScalingOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | maxTaskCount | number | The maximum number of tasks when scaling out. | | minTaskCount | number | The minimum number of tasks when scaling in. | | targetCpuUtilization | number | The target value for CPU utilization across all tasks in the service. | | targetMemoryUtilization | number | The target value for memory utilization across all tasks in the service. | --- ##### `maxTaskCount`Required ```typescript public readonly maxTaskCount: number; ``` - *Type:* number The maximum number of tasks when scaling out. --- ##### `minTaskCount`Optional ```typescript public readonly minTaskCount: number; ``` - *Type:* number - *Default:* 1 The minimum number of tasks when scaling in. --- ##### `targetCpuUtilization`Optional ```typescript public readonly targetCpuUtilization: number; ``` - *Type:* number The target value for CPU utilization across all tasks in the service. --- ##### `targetMemoryUtilization`Optional ```typescript public readonly targetMemoryUtilization: number; ``` - *Type:* number The target value for memory utilization across all tasks in the service. --- ### ConnectToProps connectToProps will have all the extra parameters which are required for connecting services. #### Initializer ```typescript import { ConnectToProps } from '@aws-cdk-containers/ecs-service-extensions' const connectToProps: ConnectToProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | localBindPort | number | localBindPort is the local port that this application should use when calling the upstream service in ECS Consul Mesh Extension Currently, this parameter will only be used in the ECSConsulMeshExtension https://github.com/aws-ia/ecs-consul-mesh-extension. | --- ##### `localBindPort`Optional ```typescript public readonly localBindPort: number; ``` - *Type:* number localBindPort is the local port that this application should use when calling the upstream service in ECS Consul Mesh Extension Currently, this parameter will only be used in the ECSConsulMeshExtension https://github.com/aws-ia/ecs-consul-mesh-extension. --- ### ContainerExtensionProps Setting for the main application container of a service. #### Initializer ```typescript import { ContainerExtensionProps } from '@aws-cdk-containers/ecs-service-extensions' const containerExtensionProps: ContainerExtensionProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | cpu | number | How much CPU the container requires. | | image | aws-cdk-lib.aws_ecs.ContainerImage | The image to run. | | memoryMiB | number | How much memory in megabytes the container requires. | | trafficPort | number | What port the image listen for traffic on. | | environment | {[ key: string ]: string} | Environment variables to pass into the container. | | environmentFiles | aws-cdk-lib.aws_ecs.EnvironmentFile[] | The environment files to pass to the container. | | logGroup | aws-cdk-lib.aws_logs.ILogGroup | The log group into which application container logs should be routed. | | secrets | {[ key: string ]: aws-cdk-lib.aws_ecs.Secret} | The secret environment variables to pass to the container. | --- ##### `cpu`Required ```typescript public readonly cpu: number; ``` - *Type:* number How much CPU the container requires. --- ##### `image`Required ```typescript public readonly image: ContainerImage; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerImage The image to run. --- ##### `memoryMiB`Required ```typescript public readonly memoryMiB: number; ``` - *Type:* number How much memory in megabytes the container requires. --- ##### `trafficPort`Required ```typescript public readonly trafficPort: number; ``` - *Type:* number What port the image listen for traffic on. --- ##### `environment`Optional ```typescript public readonly environment: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} - *Default:* No environment variables. Environment variables to pass into the container. --- ##### `environmentFiles`Optional ```typescript public readonly environmentFiles: EnvironmentFile[]; ``` - *Type:* aws-cdk-lib.aws_ecs.EnvironmentFile[] - *Default:* No environment files. The environment files to pass to the container. > [https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html) --- ##### `logGroup`Optional ```typescript public readonly logGroup: ILogGroup; ``` - *Type:* aws-cdk-lib.aws_logs.ILogGroup - *Default:* A log group is automatically created for you if the `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` feature flag is set. The log group into which application container logs should be routed. --- ##### `secrets`Optional ```typescript public readonly secrets: {[ key: string ]: Secret}; ``` - *Type:* {[ key: string ]: aws-cdk-lib.aws_ecs.Secret} - *Default:* No secret environment variables. The secret environment variables to pass to the container. --- ### CpuScalingProps The autoscaling settings. #### Initializer ```typescript import { CpuScalingProps } from '@aws-cdk-containers/ecs-service-extensions' const cpuScalingProps: CpuScalingProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | initialTaskCount | number | How many tasks to launch initially. | | maxTaskCount | number | The maximum number of tasks when scaling out. | | minTaskCount | number | The minimum number of tasks when scaling in. | | scaleInCooldown | aws-cdk-lib.Duration | How long to wait between scale in actions. | | scaleOutCooldown | aws-cdk-lib.Duration | How long to wait between scale out actions. | | targetCpuUtilization | number | The CPU utilization to try ot maintain. | --- ##### ~~`initialTaskCount`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly initialTaskCount: number; ``` - *Type:* number - *Default:* 2 How many tasks to launch initially. --- ##### ~~`maxTaskCount`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly maxTaskCount: number; ``` - *Type:* number - *Default:* 8 The maximum number of tasks when scaling out. --- ##### ~~`minTaskCount`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly minTaskCount: number; ``` - *Type:* number - *Default:* 2 The minimum number of tasks when scaling in. --- ##### ~~`scaleInCooldown`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly scaleInCooldown: Duration; ``` - *Type:* aws-cdk-lib.Duration - *Default:* 60 seconds How long to wait between scale in actions. --- ##### ~~`scaleOutCooldown`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly scaleOutCooldown: Duration; ``` - *Type:* aws-cdk-lib.Duration - *Default:* 60 seconds How long to wait between scale out actions. --- ##### ~~`targetCpuUtilization`~~Optional - *Deprecated:* use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct to configure the auto scaling target for the service. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly targetCpuUtilization: number; ``` - *Type:* number - *Default:* 50% The CPU utilization to try ot maintain. --- ### EnvironmentAttributes #### Initializer ```typescript import { EnvironmentAttributes } from '@aws-cdk-containers/ecs-service-extensions' const environmentAttributes: EnvironmentAttributes = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | capacityType | EnvironmentCapacityType | The capacity type used by the service's cluster. | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster that is providing capacity for this service. | --- ##### `capacityType`Required ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType The capacity type used by the service's cluster. --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster that is providing capacity for this service. --- ### EnvironmentProps Settings for the environment where you want to deploy your services. #### Initializer ```typescript import { EnvironmentProps } from '@aws-cdk-containers/ecs-service-extensions' const environmentProps: EnvironmentProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | capacityType | EnvironmentCapacityType | The type of capacity to use for this environment. | | cluster | aws-cdk-lib.aws_ecs.Cluster | The ECS cluster which provides compute capacity to this service. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC used by the service for networking. | --- ##### `capacityType`Optional ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType - *Default:* EnvironmentCapacityType.FARGATE The type of capacity to use for this environment. --- ##### `cluster`Optional ```typescript public readonly cluster: Cluster; ``` - *Type:* aws-cdk-lib.aws_ecs.Cluster - *Default:* Create a new cluster The ECS cluster which provides compute capacity to this service. [disable-awslint:ref-via-interface] --- ##### `vpc`Optional ```typescript public readonly vpc: IVpc; ``` - *Type:* aws-cdk-lib.aws_ec2.IVpc - *Default:* Create a new VPC The VPC used by the service for networking. --- ### FirelensProps Settings for the hook which mutates the application container to route logs through FireLens. #### Initializer ```typescript import { FirelensProps } from '@aws-cdk-containers/ecs-service-extensions' const firelensProps: FirelensProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | logGroup | aws-cdk-lib.aws_logs.LogGroup | The log group into which logs should be routed. | | parentService | Service | The parent service that is being mutated. | --- ##### `logGroup`Required ```typescript public readonly logGroup: LogGroup; ``` - *Type:* aws-cdk-lib.aws_logs.LogGroup The log group into which logs should be routed. --- ##### `parentService`Required ```typescript public readonly parentService: Service; ``` - *Type:* Service The parent service that is being mutated. --- ### HttpLoadBalancerProps #### Initializer ```typescript import { HttpLoadBalancerProps } from '@aws-cdk-containers/ecs-service-extensions' const httpLoadBalancerProps: HttpLoadBalancerProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | requestsPerTarget | number | The number of ALB requests per target. | --- ##### `requestsPerTarget`Optional ```typescript public readonly requestsPerTarget: number; ``` - *Type:* number The number of ALB requests per target. --- ### InjectableTopicProps The settings for the `InjectableTopic` class. #### Initializer ```typescript import { InjectableTopicProps } from '@aws-cdk-containers/ecs-service-extensions' const injectableTopicProps: InjectableTopicProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | topic | aws-cdk-lib.aws_sns.ITopic | The SNS Topic to publish events to. | --- ##### `topic`Required ```typescript public readonly topic: ITopic; ``` - *Type:* aws-cdk-lib.aws_sns.ITopic The SNS Topic to publish events to. --- ### InjecterExtensionProps The settings for the Injecter extension. #### Initializer ```typescript import { InjecterExtensionProps } from '@aws-cdk-containers/ecs-service-extensions' const injecterExtensionProps: InjecterExtensionProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | injectables | IInjectable[] | The list of injectable resources for this service. | --- ##### `injectables`Required ```typescript public readonly injectables: IInjectable[]; ``` - *Type:* IInjectable[] The list of injectable resources for this service. --- ### MeshProps The settings for the App Mesh extension. #### Initializer ```typescript import { MeshProps } from '@aws-cdk-containers/ecs-service-extensions' const meshProps: MeshProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | mesh | aws-cdk-lib.aws_appmesh.Mesh | The service mesh into which to register the service. | | protocol | Protocol | The protocol of the service. | --- ##### `mesh`Required ```typescript public readonly mesh: Mesh; ``` - *Type:* aws-cdk-lib.aws_appmesh.Mesh The service mesh into which to register the service. --- ##### `protocol`Optional ```typescript public readonly protocol: Protocol; ``` - *Type:* Protocol - *Default:* Protocol.HTTP The protocol of the service. Valid values are Protocol.HTTP, Protocol.HTTP2, Protocol.TCP, Protocol.GRPC --- ### QueueAutoScalingOptions Options for configuring SQS Queue auto scaling. #### Initializer ```typescript import { QueueAutoScalingOptions } from '@aws-cdk-containers/ecs-service-extensions' const queueAutoScalingOptions: QueueAutoScalingOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | acceptableLatency | aws-cdk-lib.Duration | Acceptable amount of time a message can sit in the queue (including the time required to process it). | | messageProcessingTime | aws-cdk-lib.Duration | Average amount of time for processing a single message in the queue. | --- ##### `acceptableLatency`Required ```typescript public readonly acceptableLatency: Duration; ``` - *Type:* aws-cdk-lib.Duration Acceptable amount of time a message can sit in the queue (including the time required to process it). --- ##### `messageProcessingTime`Required ```typescript public readonly messageProcessingTime: Duration; ``` - *Type:* aws-cdk-lib.Duration Average amount of time for processing a single message in the queue. --- ### QueueExtensionProps The settings for the Queue extension. #### Initializer ```typescript import { QueueExtensionProps } from '@aws-cdk-containers/ecs-service-extensions' const queueExtensionProps: QueueExtensionProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | eventsQueue | aws-cdk-lib.aws_sqs.IQueue | The user-provided default queue for this service. | | scaleOnLatency | QueueAutoScalingOptions | The user-provided queue delay fields to configure auto scaling for the default queue. | | subscriptions | ISubscribable[] | The list of subscriptions for this service. | --- ##### `eventsQueue`Optional ```typescript public readonly eventsQueue: IQueue; ``` - *Type:* aws-cdk-lib.aws_sqs.IQueue - *Default:* none The user-provided default queue for this service. If the `eventsQueue` is not provided, a default SQS Queue is created for the service. --- ##### `scaleOnLatency`Optional ```typescript public readonly scaleOnLatency: QueueAutoScalingOptions; ``` - *Type:* QueueAutoScalingOptions - *Default:* none The user-provided queue delay fields to configure auto scaling for the default queue. --- ##### `subscriptions`Optional ```typescript public readonly subscriptions: ISubscribable[]; ``` - *Type:* ISubscribable[] - *Default:* none The list of subscriptions for this service. --- ### ServiceBuild A set of mutable service props in the process of being assembled using a builder pattern. They will eventually to be translated into an ecs.Ec2ServiceProps or ecs.FargateServiceProps interface, depending on the environment's capacity type. #### Initializer ```typescript import { ServiceBuild } from '@aws-cdk-containers/ecs-service-extensions' const serviceBuild: ServiceBuild = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster in which to launch the service. | | taskDefinition | aws-cdk-lib.aws_ecs.TaskDefinition | The task definition registered to this service. | | assignPublicIp | boolean | Specifies whether the task's elastic network interface receives a public IP address. | | cloudMapOptions | aws-cdk-lib.aws_ecs.CloudMapOptions | Configuration for how to register the service in service discovery. | | desiredCount | number | How many tasks to run. | | healthCheckGracePeriod | aws-cdk-lib.Duration | How long the healthcheck can fail during initial task startup before the task is considered unhealthy. | | maxHealthyPercent | number | Maximum percentage of tasks that can be launched. | | minHealthyPercent | number | Minimum healthy task percentage. | | serviceConnectConfiguration | aws-cdk-lib.aws_ecs.ServiceConnectProps | Configuration for service connect for this service. | --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster in which to launch the service. --- ##### `taskDefinition`Required ```typescript public readonly taskDefinition: TaskDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The task definition registered to this service. --- ##### `assignPublicIp`Optional ```typescript public readonly assignPublicIp: boolean; ``` - *Type:* boolean - *Default:* false Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address. --- ##### `cloudMapOptions`Optional ```typescript public readonly cloudMapOptions: CloudMapOptions; ``` - *Type:* aws-cdk-lib.aws_ecs.CloudMapOptions - *Default:* No Cloud Map configured Configuration for how to register the service in service discovery. --- ##### `desiredCount`Optional ```typescript public readonly desiredCount: number; ``` - *Type:* number - *Default:* 1 How many tasks to run. --- ##### `healthCheckGracePeriod`Optional ```typescript public readonly healthCheckGracePeriod: Duration; ``` - *Type:* aws-cdk-lib.Duration - *Default:* No grace period How long the healthcheck can fail during initial task startup before the task is considered unhealthy. This is used to give the task more time to start passing healthchecks. --- ##### `maxHealthyPercent`Optional ```typescript public readonly maxHealthyPercent: number; ``` - *Type:* number - *Default:* 200 Maximum percentage of tasks that can be launched. --- ##### `minHealthyPercent`Optional ```typescript public readonly minHealthyPercent: number; ``` - *Type:* number - *Default:* 100 Minimum healthy task percentage. --- ##### `serviceConnectConfiguration`Optional ```typescript public readonly serviceConnectConfiguration: ServiceConnectProps; ``` - *Type:* aws-cdk-lib.aws_ecs.ServiceConnectProps - *Default:* No Service Connect configured. Configuration for service connect for this service. --- ### ServiceProps The settings for an ECS Service. #### Initializer ```typescript import { ServiceProps } from '@aws-cdk-containers/ecs-service-extensions' const serviceProps: ServiceProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | environment | IEnvironment | The environment to launch the service in. | | serviceDescription | ServiceDescription | The ServiceDescription used to build the service. | | autoScaleTaskCount | AutoScalingOptions | The options for configuring the auto scaling target. | | desiredCount | number | The desired number of instantiations of the task definition to keep running on the service. | | taskRole | aws-cdk-lib.aws_iam.IRole | The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. | --- ##### `environment`Required ```typescript public readonly environment: IEnvironment; ``` - *Type:* IEnvironment The environment to launch the service in. --- ##### `serviceDescription`Required ```typescript public readonly serviceDescription: ServiceDescription; ``` - *Type:* ServiceDescription The ServiceDescription used to build the service. --- ##### `autoScaleTaskCount`Optional ```typescript public readonly autoScaleTaskCount: AutoScalingOptions; ``` - *Type:* AutoScalingOptions - *Default:* none The options for configuring the auto scaling target. --- ##### `desiredCount`Optional ```typescript public readonly desiredCount: number; ``` - *Type:* number - *Default:* When creating the service, default is 1; when updating the service, default uses the current task number. The desired number of instantiations of the task definition to keep running on the service. --- ##### `taskRole`Optional ```typescript public readonly taskRole: IRole; ``` - *Type:* aws-cdk-lib.aws_iam.IRole - *Default:* A task role is automatically created for you. The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. --- ### SubscriptionQueue `SubscriptionQueue` represents the subscription queue object which includes the topic-specific queue and its corresponding auto scaling fields. #### Initializer ```typescript import { SubscriptionQueue } from '@aws-cdk-containers/ecs-service-extensions' const subscriptionQueue: SubscriptionQueue = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | queue | aws-cdk-lib.aws_sqs.IQueue | The user-provided queue to subscribe to the given topic. | | scaleOnLatency | QueueAutoScalingOptions | The user-provided queue delay fields to configure auto scaling for the topic-specific queue. | --- ##### `queue`Required ```typescript public readonly queue: IQueue; ``` - *Type:* aws-cdk-lib.aws_sqs.IQueue The user-provided queue to subscribe to the given topic. --- ##### `scaleOnLatency`Optional ```typescript public readonly scaleOnLatency: QueueAutoScalingOptions; ``` - *Type:* QueueAutoScalingOptions - *Default:* none The user-provided queue delay fields to configure auto scaling for the topic-specific queue. --- ### TopicSubscriptionProps The topic-specific settings for creating the queue subscriptions. #### Initializer ```typescript import { TopicSubscriptionProps } from '@aws-cdk-containers/ecs-service-extensions' const topicSubscriptionProps: TopicSubscriptionProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | topic | aws-cdk-lib.aws_sns.ITopic | The SNS Topic to subscribe to. | | queue | aws-cdk-lib.aws_sqs.IQueue | The user-provided queue to subscribe to the given topic. | | topicSubscriptionQueue | SubscriptionQueue | The object representing topic-specific queue and corresponding queue delay fields to configure auto scaling. | --- ##### `topic`Required ```typescript public readonly topic: ITopic; ``` - *Type:* aws-cdk-lib.aws_sns.ITopic The SNS Topic to subscribe to. --- ##### ~~`queue`~~Optional - *Deprecated:* use `topicSubscriptionQueue` ```typescript public readonly queue: IQueue; ``` - *Type:* aws-cdk-lib.aws_sqs.IQueue - *Default:* none The user-provided queue to subscribe to the given topic. --- ##### `topicSubscriptionQueue`Optional ```typescript public readonly topicSubscriptionQueue: SubscriptionQueue; ``` - *Type:* SubscriptionQueue - *Default:* none The object representing topic-specific queue and corresponding queue delay fields to configure auto scaling. If not provided, the default `eventsQueue` will subscribe to the given topic. --- ## Classes ### AliasedPortExtension #### Initializers ```typescript import { AliasedPortExtension } from '@aws-cdk-containers/ecs-service-extensions' new AliasedPortExtension(props: AliasedPortProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | AliasedPortProps | *No description.* | --- ##### `props`Required - *Type:* AliasedPortProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition to add containers to. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### AliasedPortMutatingHook This hook modifies the application container's settings so that its primary port mapping has a name. #### Initializers ```typescript import { AliasedPortMutatingHook } from '@aws-cdk-containers/ecs-service-extensions' new AliasedPortMutatingHook(props: AliasedPortMutatingHookProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | AliasedPortMutatingHookProps | *No description.* | --- ##### `props`Required - *Type:* AliasedPortMutatingHookProps --- #### Methods | **Name** | **Description** | | --- | --- | | mutateContainerDefinition | This is a hook for modifying the container definition of any upstream containers. | --- ##### `mutateContainerDefinition` ```typescript public mutateContainerDefinition(props: ContainerDefinitionOptions): ContainerDefinitionOptions ``` This is a hook for modifying the container definition of any upstream containers. This is primarily used for the main application container. For example, the Firelens extension wants to be able to modify the logging settings of the application container. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinitionOptions --- ### AppMeshExtension This extension adds an Envoy sidecar to the task definition and creates the App Mesh resources required to route network traffic to the container in a service mesh. The service will then be available to other App Mesh services at the address `.`. For example, a service called `orders` deploying in an environment called `production` would be accessible to other App Mesh enabled services at the address `http://orders.production`. #### Initializers ```typescript import { AppMeshExtension } from '@aws-cdk-containers/ecs-service-extensions' new AppMeshExtension(props: MeshProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | MeshProps | *No description.* | --- ##### `props`Required - *Type:* MeshProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(otherService: Service, _connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `otherService`Required - *Type:* Service --- ###### `_connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | | protocol | Protocol | The protocol used for AppMesh routing. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ##### `protocol`Required ```typescript public readonly protocol: Protocol; ``` - *Type:* Protocol The protocol used for AppMesh routing. default - Protocol.HTTP --- ### AssignPublicIpExtension Modifies the service to assign a public ip to each task and optionally exposes public IPs in a Route 53 record set. Note: If you want to change the DNS zone or record name, you will need to remove this extension completely and then re-add it. #### Initializers ```typescript import { AssignPublicIpExtension } from '@aws-cdk-containers/ecs-service-extensions' new AssignPublicIpExtension(options?: AssignPublicIpExtensionOptions) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | options | AssignPublicIpExtensionOptions | *No description.* | --- ##### `options`Optional - *Type:* AssignPublicIpExtensionOptions --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, _scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `_scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition to add containers to. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | | dns | AssignPublicIpDnsOptions | *No description.* | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ##### `dns`Optional ```typescript public readonly dns: AssignPublicIpDnsOptions; ``` - *Type:* AssignPublicIpDnsOptions --- ### CloudwatchAgentExtension This extension adds a CloudWatch agent to the task definition and configures the task to be able to publish metrics to CloudWatch. #### Initializers ```typescript import { CloudwatchAgentExtension } from '@aws-cdk-containers/ecs-service-extensions' new CloudwatchAgentExtension() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### Container The main container of a service. This is generally the container which runs your application business logic. Other extensions will attach sidecars alongside this main container. #### Initializers ```typescript import { Container } from '@aws-cdk-containers/ecs-service-extensions' new Container(props: ContainerExtensionProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | ContainerExtensionProps | *No description.* | --- ##### `props`Required - *Type:* ContainerExtensionProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | | trafficPort | number | The port on which the container expects to receive network traffic. | | logGroup | aws-cdk-lib.aws_logs.ILogGroup | The log group into which application container logs should be routed. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ##### `trafficPort`Required ```typescript public readonly trafficPort: number; ``` - *Type:* number The port on which the container expects to receive network traffic. --- ##### `logGroup`Optional ```typescript public readonly logGroup: ILogGroup; ``` - *Type:* aws-cdk-lib.aws_logs.ILogGroup The log group into which application container logs should be routed. --- ### ContainerMutatingHook This is an abstract class wrapper for a mutating hook. It is extended by any extension which wants to mutate other extension's containers. #### Initializers ```typescript import { ContainerMutatingHook } from '@aws-cdk-containers/ecs-service-extensions' new ContainerMutatingHook() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | mutateContainerDefinition | This is a hook for modifying the container definition of any upstream containers. | --- ##### `mutateContainerDefinition` ```typescript public mutateContainerDefinition(props: ContainerDefinitionOptions): ContainerDefinitionOptions ``` This is a hook for modifying the container definition of any upstream containers. This is primarily used for the main application container. For example, the Firelens extension wants to be able to modify the logging settings of the application container. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinitionOptions The container definition to mutate. --- ### FireLensExtension This extension adds a FluentBit log router to the task definition and does all the configuration necessarily to enable log routing for the task using FireLens. #### Initializers ```typescript import { FireLensExtension } from '@aws-cdk-containers/ecs-service-extensions' new FireLensExtension() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### FirelensMutatingHook This hook modifies the application container's settings so that it routes logs using FireLens. #### Initializers ```typescript import { FirelensMutatingHook } from '@aws-cdk-containers/ecs-service-extensions' new FirelensMutatingHook(props: FirelensProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | FirelensProps | *No description.* | --- ##### `props`Required - *Type:* FirelensProps --- #### Methods | **Name** | **Description** | | --- | --- | | mutateContainerDefinition | This is a hook for modifying the container definition of any upstream containers. | --- ##### `mutateContainerDefinition` ```typescript public mutateContainerDefinition(props: ContainerDefinitionOptions): ContainerDefinitionOptions ``` This is a hook for modifying the container definition of any upstream containers. This is primarily used for the main application container. For example, the Firelens extension wants to be able to modify the logging settings of the application container. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinitionOptions --- ### HttpLoadBalancerExtension This extension add a public facing load balancer for sending traffic to one or more replicas of the application container. #### Initializers ```typescript import { HttpLoadBalancerExtension } from '@aws-cdk-containers/ecs-service-extensions' new HttpLoadBalancerExtension(props?: HttpLoadBalancerProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | HttpLoadBalancerProps | *No description.* | --- ##### `props`Optional - *Type:* HttpLoadBalancerProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition to add containers to. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### InjectableTopic - *Implements:* IGrantInjectable The `InjectableTopic` class represents SNS Topic resource that can be published events to by the parent service. #### Initializers ```typescript import { InjectableTopic } from '@aws-cdk-containers/ecs-service-extensions' new InjectableTopic(props: InjectableTopicProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | InjectableTopicProps | *No description.* | --- ##### `props`Required - *Type:* InjectableTopicProps --- #### Methods | **Name** | **Description** | | --- | --- | | environmentVariables | *No description.* | | grant | *No description.* | --- ##### `environmentVariables` ```typescript public environmentVariables(): {[ key: string ]: string} ``` ##### `grant` ```typescript public grant(taskDefinition: TaskDefinition): void ``` ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | topic | aws-cdk-lib.aws_sns.ITopic | *No description.* | --- ##### `topic`Required ```typescript public readonly topic: ITopic; ``` - *Type:* aws-cdk-lib.aws_sns.ITopic --- ### InjecterExtension This extension accepts a list of `Injectable` resources that the parent service can publish events or write data to. It sets up the corresponding permissions for the task role of the parent service. #### Initializers ```typescript import { InjecterExtension } from '@aws-cdk-containers/ecs-service-extensions' new InjecterExtension(props: InjecterExtensionProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | InjecterExtensionProps | *No description.* | --- ##### `props`Required - *Type:* InjecterExtensionProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | Add hooks to the main application extension so that it is modified to add the injectable resource environment variables to the container environment. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | After the task definition has been created, this hook grants the required permissions to the task role for the parent service. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` Add hooks to the main application extension so that it is modified to add the injectable resource environment variables to the container environment. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` After the task definition has been created, this hook grants the required permissions to the task role for the parent service. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### QueueExtension This extension creates a default `eventsQueue` for the service (if not provided) and accepts a list of objects of type `ISubscribable` that the `eventsQueue` subscribes to. It creates the subscriptions and sets up permissions for the service to consume messages from the SQS Queues. It also configures a target tracking scaling policy for the service to maintain an acceptable queue latency by tracking the backlog per task. For more information, please refer: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html . The default queue for this service can be accessed using the getter `.eventsQueue`. #### Initializers ```typescript import { QueueExtension } from '@aws-cdk-containers/ecs-service-extensions' new QueueExtension(props?: QueueExtensionProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | QueueExtensionProps | *No description.* | --- ##### `props`Optional - *Type:* QueueExtensionProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | Add hooks to the main application extension so that it is modified to add the events queue URL to the container environment. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | This hook creates (if required) and sets the default queue `eventsQueue`. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | After the task definition has been created, this hook grants SQS permissions to the task role. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` Add hooks to the main application extension so that it is modified to add the events queue URL to the container environment. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` This hook creates (if required) and sets the default queue `eventsQueue`. It also sets up the subscriptions for the provided `ISubscribable` objects. ###### `service`Required - *Type:* Service The parent service which this extension has been added to. --- ###### `scope`Required - *Type:* constructs.Construct The scope that this extension should create resources in. --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is used to add target tracking scaling policies for the SQS Queues of the service. It also creates an AWS Lambda Function for calculating the backlog per task metric. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` After the task definition has been created, this hook grants SQS permissions to the task role. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | | eventsQueue | aws-cdk-lib.aws_sqs.IQueue | *No description.* | | autoscalingOptions | QueueAutoScalingOptions | *No description.* | | logGroup | aws-cdk-lib.aws_logs.ILogGroup | The log group created by the extension where the AWS Lambda function logs are stored. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ##### `eventsQueue`Required ```typescript public readonly eventsQueue: IQueue; ``` - *Type:* aws-cdk-lib.aws_sqs.IQueue --- ##### `autoscalingOptions`Optional ```typescript public readonly autoscalingOptions: QueueAutoScalingOptions; ``` - *Type:* QueueAutoScalingOptions --- ##### `logGroup`Optional ```typescript public readonly logGroup: ILogGroup; ``` - *Type:* aws-cdk-lib.aws_logs.ILogGroup The log group created by the extension where the AWS Lambda function logs are stored. --- ### ScaleOnCpuUtilization This extension helps you scale your service according to CPU utilization. #### Initializers ```typescript import { ScaleOnCpuUtilization } from '@aws-cdk-containers/ecs-service-extensions' new ScaleOnCpuUtilization(props?: CpuScalingProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | CpuScalingProps | *No description.* | --- ##### `props`Optional - *Type:* CpuScalingProps --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### ~~`addContainerMutatingHook`~~ ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### ~~`addHooks`~~ ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### ~~`connectToService`~~ ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### ~~`modifyServiceProps`~~ ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild --- ##### ~~`modifyTaskDefinitionProps`~~ ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### ~~`prehook`~~ ```typescript public prehook(parent: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `parent`Required - *Type:* Service The parent service which this extension has been added to. --- ###### `scope`Required - *Type:* constructs.Construct The scope that this extension should create resources in. --- ##### ~~`resolveContainerDependencies`~~ ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### ~~`useService`~~ ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService --- ##### ~~`useTaskDefinition`~~ ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition to add containers to. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | | initialTaskCount | number | How many tasks to launch initially. | | maxTaskCount | number | The maximum number of tasks when scaling out. | | minTaskCount | number | The minimum number of tasks when scaling in. | | scaleInCooldown | aws-cdk-lib.Duration | How long to wait between scale in actions. | | scaleOutCooldown | aws-cdk-lib.Duration | How long to wait between scale out actions. | | targetCpuUtilization | number | The CPU utilization to try ot maintain. | --- ##### ~~`name`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### ~~`container`~~Optional - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ##### ~~`initialTaskCount`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly initialTaskCount: number; ``` - *Type:* number How many tasks to launch initially. --- ##### ~~`maxTaskCount`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly maxTaskCount: number; ``` - *Type:* number The maximum number of tasks when scaling out. --- ##### ~~`minTaskCount`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly minTaskCount: number; ``` - *Type:* number The minimum number of tasks when scaling in. --- ##### ~~`scaleInCooldown`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly scaleInCooldown: Duration; ``` - *Type:* aws-cdk-lib.Duration How long to wait between scale in actions. --- ##### ~~`scaleOutCooldown`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly scaleOutCooldown: Duration; ``` - *Type:* aws-cdk-lib.Duration How long to wait between scale out actions. --- ##### ~~`targetCpuUtilization`~~Required - *Deprecated:* To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . ```typescript public readonly targetCpuUtilization: number; ``` - *Type:* number The CPU utilization to try ot maintain. --- ### ServiceDescription A ServiceDescription is a wrapper for all of the extensions that a user wants to add to an ECS Service. It collects all of the extensions that are added to a service, allowing each extension to query the full list of extensions added to a service to determine information about how to self-configure. #### Initializers ```typescript import { ServiceDescription } from '@aws-cdk-containers/ecs-service-extensions' new ServiceDescription() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | add | Adds a new extension to the service. | | get | Get the extension with a specific name. | --- ##### `add` ```typescript public add(extension: ServiceExtension): ServiceDescription ``` Adds a new extension to the service. The extensions mutate a service to add resources to or configure properties for the service. ###### `extension`Required - *Type:* ServiceExtension The extension that you wish to add. --- ##### `get` ```typescript public get(name: string): ServiceExtension ``` Get the extension with a specific name. This is generally used by extensions in order to discover each other. ###### `name`Required - *Type:* string --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | extensions | {[ key: string ]: ServiceExtension} | The list of extensions that have been registered to run when preparing this service. | --- ##### `extensions`Required ```typescript public readonly extensions: {[ key: string ]: ServiceExtension}; ``` - *Type:* {[ key: string ]: ServiceExtension} The list of extensions that have been registered to run when preparing this service. --- ### ServiceExtension The shape of a service extension. This abstract class is implemented by other extensions that extend the hooks to implement any custom logic that they want to run during each step of preparing the service. #### Initializers ```typescript import { ServiceExtension } from '@aws-cdk-containers/ecs-service-extensions' new ServiceExtension(name: string) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | *No description.* | --- ##### `name`Required - *Type:* string --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(parent: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `parent`Required - *Type:* Service The parent service which this extension has been added to. --- ###### `scope`Required - *Type:* constructs.Construct The scope that this extension should create resources in. --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition The created task definition to add containers to. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ### TopicSubscription - *Implements:* ISubscribable The `TopicSubscription` class represents an SNS Topic resource that can be subscribed to by the service queues. #### Initializers ```typescript import { TopicSubscription } from '@aws-cdk-containers/ecs-service-extensions' new TopicSubscription(props: TopicSubscriptionProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | props | TopicSubscriptionProps | *No description.* | --- ##### `props`Required - *Type:* TopicSubscriptionProps --- #### Methods | **Name** | **Description** | | --- | --- | | subscribe | This method sets up SNS Topic subscriptions for the SQS queue provided by the user. | --- ##### `subscribe` ```typescript public subscribe(extension: QueueExtension): IQueue ``` This method sets up SNS Topic subscriptions for the SQS queue provided by the user. If a `queue` is not provided, the default `eventsQueue` subscribes to the given topic. ###### `extension`Required - *Type:* QueueExtension `QueueExtension` added to the service. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | topic | aws-cdk-lib.aws_sns.ITopic | *No description.* | | queue | aws-cdk-lib.aws_sqs.IQueue | The queue that subscribes to the given topic. | | subscriptionQueue | SubscriptionQueue | The subscription queue object for this subscription. | --- ##### `topic`Required ```typescript public readonly topic: ITopic; ``` - *Type:* aws-cdk-lib.aws_sns.ITopic --- ##### ~~`queue`~~Optional - *Deprecated:* use `subscriptionQueue` ```typescript public readonly queue: IQueue; ``` - *Type:* aws-cdk-lib.aws_sqs.IQueue - *Default:* none The queue that subscribes to the given topic. --- ##### `subscriptionQueue`Optional ```typescript public readonly subscriptionQueue: SubscriptionQueue; ``` - *Type:* SubscriptionQueue - *Default:* none The subscription queue object for this subscription. --- ### XRayExtension This extension adds an X-Ray daemon inside the task definition for capturing application trace spans and submitting them to the AWS X-Ray service. #### Initializers ```typescript import { XRayExtension } from '@aws-cdk-containers/ecs-service-extensions' new XRayExtension() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | addContainerMutatingHook | This hook allows another service extension to register a mutating hook for changing the primary container of this extension. | | addHooks | A hook that allows the extension to add hooks to other extensions that are registered. | | connectToService | This hook allows the extension to establish a connection to extensions from another service. | | modifyServiceProps | Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. | | modifyTaskDefinitionProps | This is a hook which allows extensions to modify the settings of the task definition prior to it being created. | | prehook | A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. | | resolveContainerDependencies | Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. | | useService | When this hook is implemented by extension, it allows the extension to use the service which has been created. | | useTaskDefinition | Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. | --- ##### `addContainerMutatingHook` ```typescript public addContainerMutatingHook(hook: ContainerMutatingHook): void ``` This hook allows another service extension to register a mutating hook for changing the primary container of this extension. This is primarily used for the application extension. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens. ###### `hook`Required - *Type:* ContainerMutatingHook --- ##### `addHooks` ```typescript public addHooks(): void ``` A hook that allows the extension to add hooks to other extensions that are registered. ##### `connectToService` ```typescript public connectToService(service: Service, connectToProps?: ConnectToProps): void ``` This hook allows the extension to establish a connection to extensions from another service. Usually used for things like allowing one service to talk to the load balancer or service mesh proxy for another service. ###### `service`Required - *Type:* Service The other service to connect to. --- ###### `connectToProps`Optional - *Type:* ConnectToProps --- ##### `modifyServiceProps` ```typescript public modifyServiceProps(props: ServiceBuild): ServiceBuild ``` Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created. ###### `props`Required - *Type:* ServiceBuild The service properties to mutate. --- ##### `modifyTaskDefinitionProps` ```typescript public modifyTaskDefinitionProps(props: TaskDefinitionProps): TaskDefinitionProps ``` This is a hook which allows extensions to modify the settings of the task definition prior to it being created. For example, the App Mesh extension needs to configure an Envoy proxy in the task definition, or the Application extension wants to set the overall resource for the task. ###### `props`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinitionProps Properties of the task definition to be created. --- ##### `prehook` ```typescript public prehook(service: Service, scope: Construct): void ``` A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance. ###### `service`Required - *Type:* Service --- ###### `scope`Required - *Type:* constructs.Construct --- ##### `resolveContainerDependencies` ```typescript public resolveContainerDependencies(): void ``` Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled. ##### `useService` ```typescript public useService(service: Ec2Service | FargateService): void ``` When this hook is implemented by extension, it allows the extension to use the service which has been created. It is generally used to create any final resources which might depend on the service itself. ###### `service`Required - *Type:* aws-cdk-lib.aws_ecs.Ec2Service | aws-cdk-lib.aws_ecs.FargateService The generated service. --- ##### `useTaskDefinition` ```typescript public useTaskDefinition(taskDefinition: TaskDefinition): void ``` Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc. ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | The name of the extension. | | container | aws-cdk-lib.aws_ecs.ContainerDefinition | The container for this extension. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string The name of the extension. --- ##### `container`Optional ```typescript public readonly container: ContainerDefinition; ``` - *Type:* aws-cdk-lib.aws_ecs.ContainerDefinition The container for this extension. Most extensions have a container, but not every extension is required to have a container. Some extensions may just modify the properties of the service, or create external resources connected to the service. --- ## Protocols ### IEnvironment - *Implemented By:* Environment, ImportedEnvironment, IEnvironment An environment into which to deploy a service. #### Methods | **Name** | **Description** | | --- | --- | | addDefaultCloudMapNamespace | Add a default cloudmap namespace to the environment's cluster. | --- ##### `addDefaultCloudMapNamespace` ```typescript public addDefaultCloudMapNamespace(options: CloudMapNamespaceOptions): void ``` Add a default cloudmap namespace to the environment's cluster. ###### `options`Required - *Type:* aws-cdk-lib.aws_ecs.CloudMapNamespaceOptions --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | capacityType | EnvironmentCapacityType | The capacity type used by the service's cluster. | | cluster | aws-cdk-lib.aws_ecs.ICluster | The cluster that is providing capacity for this service. | | id | string | The name of this environment. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC into which environment services should be placed. | --- ##### `capacityType`Required ```typescript public readonly capacityType: EnvironmentCapacityType; ``` - *Type:* EnvironmentCapacityType The capacity type used by the service's cluster. --- ##### `cluster`Required ```typescript public readonly cluster: ICluster; ``` - *Type:* aws-cdk-lib.aws_ecs.ICluster The cluster that is providing capacity for this service. --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string The name of this environment. --- ##### `vpc`Required ```typescript public readonly vpc: IVpc; ``` - *Type:* aws-cdk-lib.aws_ec2.IVpc The VPC into which environment services should be placed. --- ### IGrantInjectable - *Extends:* IInjectable - *Implemented By:* InjectableTopic, IGrantInjectable An interface that will be implemented by all the injectable resources that need to grant permissions to the task role. #### Methods | **Name** | **Description** | | --- | --- | | grant | *No description.* | --- ##### `grant` ```typescript public grant(taskDefinition: TaskDefinition): void ``` ###### `taskDefinition`Required - *Type:* aws-cdk-lib.aws_ecs.TaskDefinition --- ### IInjectable - *Implemented By:* InjectableTopic, IGrantInjectable, IInjectable An interface that will be implemented by all the resources that can be published events or written data to. #### Methods | **Name** | **Description** | | --- | --- | | environmentVariables | *No description.* | --- ##### `environmentVariables` ```typescript public environmentVariables(): {[ key: string ]: string} ``` ### ISubscribable - *Implemented By:* TopicSubscription, ISubscribable An interface that will be implemented by all the resources that can be subscribed to. #### Methods | **Name** | **Description** | | --- | --- | | subscribe | All classes implementing this interface must also implement the `subscribe()` method. | --- ##### `subscribe` ```typescript public subscribe(extension: QueueExtension): IQueue ``` All classes implementing this interface must also implement the `subscribe()` method. ###### `extension`Required - *Type:* QueueExtension --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | subscriptionQueue | SubscriptionQueue | The `SubscriptionQueue` object for the `ISubscribable` object. | --- ##### `subscriptionQueue`Optional ```typescript public readonly subscriptionQueue: SubscriptionQueue; ``` - *Type:* SubscriptionQueue - *Default:* none The `SubscriptionQueue` object for the `ISubscribable` object. --- ## Enums ### EnvironmentCapacityType The types of capacity that are supported. These capacity types may change the behavior of an extension. #### Members | **Name** | **Description** | | --- | --- | | FARGATE | Specify that the environment should use AWS Fargate for hosting containers. | | EC2 | Specify that the environment should launch containers onto EC2 instances. | --- ##### `FARGATE` Specify that the environment should use AWS Fargate for hosting containers. --- ##### `EC2` Specify that the environment should launch containers onto EC2 instances. --- ### Protocol Enum of supported AppMesh protocols. #### Members | **Name** | **Description** | | --- | --- | | HTTP | *No description.* | | TCP | *No description.* | | HTTP2 | *No description.* | | GRPC | *No description.* | --- ##### `HTTP` --- ##### `TCP` --- ##### `HTTP2` --- ##### `GRPC` ---