awscdkcontainersecsserviceextensions

package module
v2.0.0-alpha.288 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

README

CDK Construct library for building ECS services

---


This library provides a high level, extensible pattern for constructing services deployed using Amazon ECS.

import {
  AppMeshExtension,
  CloudwatchAgentExtension,
  Container,
  Environment,
  FireLensExtension,
  HttpLoadBalancerExtension,
  Service,
  ServiceDescription,
  XRayExtension,
} from '@aws-cdk-containers/ecs-service-extensions';

If you are using the @aws-cdk-containers/ecs-service-extensions v1 and need to migrate to v2, see the Migration Guide.

Service construct

The Service construct provided by this module can be extended with optional ServiceExtension classes that add supplemental ECS features including:

The ServiceExtension class is an abstract class which you can also implement in order to build your own custom service extensions for modifying your service, or attaching your own custom resources or sidecars.

Example

// Create an environment to deploy a service in.
const environment = new Environment(this, 'production');

// Build out the service description
const nameDescription = new ServiceDescription();
nameDescription.add(new Container({
  cpu: 1024,
  memoryMiB: 2048,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('nathanpeck/name'),
  environment: {
    PORT: '80',
  },
}));

declare const mesh: appmesh.Mesh;
nameDescription.add(new AppMeshExtension({ mesh }));
nameDescription.add(new FireLensExtension());
nameDescription.add(new XRayExtension());
nameDescription.add(new CloudwatchAgentExtension());
nameDescription.add(new HttpLoadBalancerExtension());

// Implement the service description as a real service inside
// an environment.
const nameService = new Service(this, 'name', {
  environment: environment,
  serviceDescription: nameDescription,
});

Creating an Environment

An Environment is a place to deploy your services. You can have multiple environments on a single AWS account. For example, you could create a test environment as well as a production environment so you have a place to verify that your application works as intended before you deploy it to a live environment.

Each environment is isolated from other environments. In other words, when you create an environment, by default the construct supplies its own VPC, ECS Cluster, and any other required resources for the environment:

const environment = new Environment(this, 'production');

However, you can also choose to build an environment out of a pre-existing VPC or ECS Cluster:

declare const vpc: ec2.Vpc;
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });

const environment = new Environment(this, 'production', {
  vpc,
  cluster,
});

Defining your ServiceDescription

The ServiceDescription defines what application you want the service to run and what optional extensions you want to add to the service. The most basic form of a ServiceDescription looks like this:

const nameDescription = new ServiceDescription();
nameDescription.add(new Container({
  cpu: 1024,
  memoryMiB: 2048,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('nathanpeck/name'),
  environment: {
    PORT: '80',
  },
}));

Every ServiceDescription requires at minimum that you add a Container extension which defines the main application (essential) container to run for the service.

Logging using awslogs log driver

If no observability extensions have been configured for a service, the ECS Service Extensions configures an awslogs log driver for the application container of the service to send the container logs to CloudWatch Logs.

You can either provide a log group to the Container extension or one will be created for you by the CDK.

Following is an example of an application with an awslogs log driver configured for the application container:

import * as logs from 'aws-cdk-lib/aws-logs';

const environment = new Environment(this, 'production');

const nameDescription = new ServiceDescription();
nameDescription.add(new Container({
  cpu: 1024,
  memoryMiB: 2048,
  trafficPort: 80,
  image: ContainerImage.fromRegistry('nathanpeck/name'),
  environment: {
    PORT: '80',
  },
  logGroup: new logs.LogGroup(this, 'MyLogGroup'),
}));

If a log group is not provided, no observability extensions have been created, and the ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER feature flag is enabled, then logging will be configured by default and a log group will be created for you.

The ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER feature flag is enabled by default in any CDK apps that are created with CDK v1.140.0 or v2.8.0 and later.

To enable default logging for previous versions, ensure that the ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER flag within the application stack context is set to true, like so:

import * as cxapi from '@aws-cdk/cx-api';

this.node.setContext(cxapi.ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER, true);

Alternatively, you can also set the feature flag in the cdk.json file. For more information, refer the docs.

After adding the Container extension, you can optionally enable additional features for the service using the ServiceDescription.add() method:

declare const mesh: appmesh.Mesh;
const nameDescription = new ServiceDescription();

nameDescription.add(new AppMeshExtension({ mesh }));
nameDescription.add(new FireLensExtension());
nameDescription.add(new XRayExtension());
nameDescription.add(new CloudwatchAgentExtension());
nameDescription.add(new HttpLoadBalancerExtension());
nameDescription.add(new AssignPublicIpExtension());

Launching the ServiceDescription as a Service

Once the service description is defined, you can launch it as a service:

const environment = new Environment(this, 'production');
const nameDescription = new ServiceDescription();

const nameService = new Service(this, 'name', {
  environment: environment,
  serviceDescription: nameDescription,
});

At this point, all the service resources will be created. This includes the ECS Task Definition, Service, as well as any other attached resources, such as App Mesh Virtual Node or an Application Load Balancer.

Creating your own taskRole

Sometimes the taskRole should be defined outside of the service so that you can create strict resource policies (ie. S3 bucket policies) that are restricted to a given taskRole:

const taskRole = new iam.Role(this, 'CustomTaskRole', {
  assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'),
});

// Use taskRole in any CDK resource policies
// new s3.BucketPolicy(this, 'BucketPolicy, {});

const environment = new Environment(this, 'production');
const nameDescription = new ServiceDescription();
const nameService = new Service(this, 'name', {
  environment: environment,
  serviceDescription: nameDescription,
  taskRole,
});

Configure Custom Health Check

When you add an HTTPLoadBalancerExtension, you can customize the health checks by accessing the targetGroup field on the service.

const service = new Service(stack, 'my-service', {
  environment,
  serviceDescription,
  autoScaleTaskCount: {
    maxTaskCount: 5,
  },
});

service.targetGroup.configureHealthCheck({
  path: '/',
  port: '80',
});

Task Auto-Scaling

You can configure the task count of a service to match demand. The recommended way of achieving this is to configure target tracking policies for your service which scales in and out in order to keep metrics around target values.

You need to configure an auto scaling target for the service by setting the minTaskCount (defaults to 1) and maxTaskCount in the Service construct. Then you can specify target values for "CPU Utilization" or "Memory Utilization" across all tasks in your service. Note that the desiredCount value will be set to undefined if the auto scaling target is configured.

If you want to configure auto-scaling policies based on resources like Application Load Balancer or SQS Queues, you can set the corresponding resource-specific fields in the extension. For example, you can enable target tracking scaling based on Application Load Balancer request count as follows:

const environment = new Environment(this, 'production');
const serviceDescription = new ServiceDescription();

serviceDescription.add(new Container({
  cpu: 256,
  memoryMiB: 512,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('my-alb'),
}));

// Add the extension with target `requestsPerTarget` value set
serviceDescription.add(new HttpLoadBalancerExtension({ requestsPerTarget: 10 }));

// Configure the auto scaling target
new Service(this, 'my-service', {
  environment,
  serviceDescription,
  desiredCount: 5,
  // Task auto-scaling constuct for the service
  autoScaleTaskCount: {
    maxTaskCount: 10,
    targetCpuUtilization: 70,
    targetMemoryUtilization: 50,
  },
});

You can also define your own service extensions for other auto-scaling policies for your service by making use of the scalableTaskCount attribute of the Service class.

Creating your own custom ServiceExtension

In addition to using the default service extensions that come with this module, you can choose to implement your own custom service extensions. The ServiceExtension class is an abstract class you can implement yourself. The following example implements a custom service extension that could be added to a service in order to autoscale it based on scaling intervals of SQS Queue size:

export class MyCustomAutoscaling extends ServiceExtension {
  constructor() {
    super('my-custom-autoscaling');
    // Scaling intervals for the step scaling policy
    this.scalingSteps = [{ upper: 0, change: -1 }, { lower: 100, change: +1 }, { lower: 500, change: +5 }];
    this.sqsQueue = new sqs.Queue(this.scope, 'my-queue');
  }

  // This hook utilizes the resulting service construct
  // once it is created
  public useService(service: ecs.Ec2Service | ecs.FargateService) {
    this.parentService.scalableTaskCount.scaleOnMetric('QueueMessagesVisibleScaling', {
      metric: this.sqsQueue.metricApproximateNumberOfMessagesVisible(),
      scalingSteps: this.scalingSteps,
    });
  }
}

This ServiceExtension can now be reused and added to any number of different service descriptions. This allows you to develop reusable bits of configuration, attach them to many different services, and centrally manage them. Updating the ServiceExtension in one place would update all services that use it, instead of requiring decentralized updates to many different services.

Every ServiceExtension can implement the following hooks to modify the properties of constructs, or make use of the resulting constructs:

  • addHooks() - This hook is called after all the extensions are added to a ServiceDescription, but before any of the other extension hooks have been run. It gives each extension a chance to do some inspection of the overall ServiceDescription and see what other extensions have been added. Some extensions may want to register hooks on the other extensions to modify them. For example, the Firelens extension wants to be able to modify the settings of the application container to route logs through Firelens.
  • modifyTaskDefinitionProps() - This is hook is passed the proposed ecs.TaskDefinitionProps for a TaskDefinition that is about to be created. This allows the extension to make modifications to the task definition props before the TaskDefinition is created. For example, the App Mesh extension modifies the proxy settings for the task.
  • useTaskDefinition() - After the TaskDefinition is created, this hook is passed the actual TaskDefinition construct that was created. This allows the extension to add containers to the task, modify the task definition's IAM role, etc.
  • resolveContainerDependencies() - Once all extensions have added their containers, each extension is given a chance to modify its container's dependsOn settings. Extensions need to check and see what other extensions were enabled and decide whether their container needs to wait on another container to start first.
  • modifyServiceProps() - Before an Ec2Service or FargateService is created, this hook is passed a draft version of the service props to change. Each extension adds its own modifications to the service properties. For example, the App Mesh extension needs to modify the service settings to enable CloudMap service discovery.
  • useService() - After the service is created, this hook is given a chance to utilize that service. This is used by extensions like the load balancer or App Mesh extension, which create and link other AWS resources to the ECS extension.
  • connectToService() - This hook is called when a user wants to connect one service to another service. It allows an extension to implement logic about how to allow connections from one service to another. For example, the App Mesh extension implements this method in order to easily connect one service mesh service to another, which allows the service's Envoy proxy sidecars to route traffic to each other.

Connecting services

One of the hooks that a ServiceExtension can implement is a hook for connection logic. This is utilized when connecting one service to another service, e.g. connecting a user facing web service with a backend API. Usage looks like this:

const frontendDescription = new ServiceDescription();
const frontend = new Service(this, 'frontend', {
  environment,
  serviceDescription: frontendDescription,
});

const backendDescription = new ServiceDescription();
const backend = new Service(this, 'backend', {
  environment,
  serviceDescription: backendDescription,
});

frontend.connectTo(backend);

The address that a service will use to talk to another service depends on the type of ingress that has been created by the extension that did the connecting. For example, if an App Mesh extension has been used, then the service is accessible at a DNS address of <service name>.<environment name>. For example:

const environment = new Environment(this, 'production');

// Define the frontend tier
const frontendDescription = new ServiceDescription();
frontendDescription.add(new Container({
  cpu: 1024,
  memoryMiB: 2048,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('my-frontend-service'),
  environment: {
    BACKEND_URL: 'http://backend.production',
  },
}));

const frontend = new Service(this, 'frontend', {
  environment,
  serviceDescription: frontendDescription,
});

// Define the backend tier
const backendDescription = new ServiceDescription();
backendDescription.add(new Container({
  cpu: 1024,
  memoryMiB: 2048,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('my-backend-service'),
  environment: {
    FRONTEND_URL: 'http://frontend.production',
  },
}));
const backend = new Service(this, 'backend', {
  environment,
  serviceDescription: backendDescription,
});

// Connect the two tiers to each other
frontend.connectTo(backend);

The above code uses the well-known service discovery name for each service, and passes it as an environment variable to the container so that the container knows what address to use when communicating to the other service.

Importing a pre-existing cluster

To create an environment with a pre-existing cluster, you must import the cluster first, then use Environment.fromEnvironmentAttributes(). When a cluster is imported into an environment, the cluster is treated as immutable. As a result, no extension may modify the cluster to change a setting.

declare const cluster: ecs.Cluster;

const environment = Environment.fromEnvironmentAttributes(this, 'Environment', {
  capacityType: ecs.EnvironmentCapacityType.EC2, // or `FARGATE`
  cluster,
});

Injecter Extension

This service extension accepts a list of Injectable resources. It grants access to these resources and adds the necessary environment variables to the tasks that are part of the service.

For example, an InjectableTopic is an SNS Topic that grants permission to the task role and adds the topic ARN as an environment variable to the task definition.

Publishing to SNS Topics

You can use this extension to set up publishing permissions for SNS Topics.

const nameDescription = new ServiceDescription();
nameDescription.add(new InjecterExtension({
  injectables: [new InjectableTopic({
    // SNS Topic the service will publish to
    topic: new sns.Topic(this, 'my-topic'),
  })],
}));

Queue Extension

This service extension creates a default SQS Queue eventsQueue for the service (if not provided) and optionally also accepts list of ISubscribable objects that the eventsQueue can subscribe to. The service extension creates the subscriptions and sets up permissions for the service to consume messages from the SQS Queue.

Setting up SNS Topic Subscriptions for SQS Queues

You can use this extension to set up SNS Topic subscriptions for the eventsQueue. To do this, create a new object of type TopicSubscription for every SNS Topic you want the eventsQueue to subscribe to and provide it as input to the service extension.

const nameDescription = new ServiceDescription();
const myServiceDescription = nameDescription.add(new QueueExtension({
  // Provide list of topic subscriptions that you want the `eventsQueue` to subscribe to
  subscriptions: [new TopicSubscription({
    topic: new sns.Topic(this, 'my-topic'),
  }],
}));

// To access the `eventsQueue` for the service, use the `eventsQueue` getter for the extension
const myQueueExtension = myServiceDescription.extensions.queue as QueueExtension;
const myEventsQueue = myQueueExtension.eventsQueue;

For setting up a topic-specific queue subscription, you can provide a custom queue in the TopicSubscription object along with the SNS Topic. The extension will set up a topic subscription for the provided queue instead of the default eventsQueue of the service.

declare const myEventsQueue: sqs.Queue;
declare const myTopicQueue: sqs.Queue;
const nameDescription = new ServiceDescription();

nameDescription.add(new QueueExtension({
  eventsQueue: myEventsQueue,
  subscriptions: [new TopicSubscription({
    topic: new sns.Topic(this, 'my-topic'),
    // `myTopicQueue` will subscribe to the `my-topic` instead of `eventsQueue`
    topicSubscriptionQueue: {
      queue: myTopicQueue,
    },
  }],
}));
Configuring auto scaling based on SQS Queues

You can scale your service up or down to maintain an acceptable queue latency by tracking the backlog per task. It configures a target tracking scaling policy with target value (acceptable backlog per task) calculated by dividing the acceptableLatency by messageProcessingTime. For example, if the maximum acceptable latency for a message to be processed after its arrival in the SQS Queue is 10 mins and the average processing time for a task is 250 milliseconds per message, then acceptableBacklogPerTask = 10 * 60 / 0.25 = 2400. Therefore, each queue can hold up to 2400 messages before the service starts to scale up. For this, a target tracking policy will be attached to the scaling target for your service with target value 2400. For more information, please refer: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html .

You can configure auto scaling based on SQS Queue for your service as follows:

declare const myEventsQueue: sqs.Queue;
declare const myTopicQueue: sqs.Queue;
const nameDescription = new ServiceDescription();

nameDescription.add(new QueueExtension({
  eventsQueue: myEventsQueue,
  // Need to specify `scaleOnLatency` to configure auto scaling based on SQS Queue
  scaleOnLatency: {
    acceptableLatency: Duration.minutes(10),
    messageProcessingTime: Duration.millis(250),
  },
  subscriptions: [new TopicSubscription({
    topic: new sns.Topic(this, 'my-topic'),
    // `myTopicQueue` will subscribe to the `my-topic` instead of `eventsQueue`
    topicSubscriptionQueue: {
      queue: myTopicQueue,
      // Optionally provide `scaleOnLatency` for configuring separate autoscaling for `myTopicQueue`
      scaleOnLatency: {
        acceptableLatency: Duration.minutes(10),
        messageProcessingTime: Duration.millis(250),
      },
    },
  }],
}));

Publish/Subscribe Service Pattern

The Publish/Subscribe Service Pattern is used for implementing asynchronous communication between services. It involves 'publisher' services emitting events to SNS Topics, which are passed to subscribed SQS queues and then consumed by 'worker' services.

The following example adds the InjecterExtension to a Publisher Service which can publish events to an SNS Topic and adds the QueueExtension to a Worker Service which can poll its eventsQueue to consume messages populated by the topic.

const environment = new Environment(this, 'production');

const pubServiceDescription = new ServiceDescription();
pubServiceDescription.add(new Container({
  cpu: 256,
  memoryMiB: 512,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('sns-publish'),
}));

const myTopic = new sns.Topic(this, 'myTopic');

// Add the `InjecterExtension` to the service description to allow publishing events to `myTopic`
pubServiceDescription.add(new InjecterExtension({
  injectables: [new InjectableTopic({
    topic: myTopic,
  }],
}));

// Create the `Publisher` Service
new Service(this, 'Publisher', {
  environment: environment,
  serviceDescription: pubServiceDescription,
});

const subServiceDescription = new ServiceDescription();
subServiceDescription.add(new Container({
  cpu: 256,
  memoryMiB: 512,
  trafficPort: 80,
  image: ecs.ContainerImage.fromRegistry('sqs-reader'),
}));

// Add the `QueueExtension` to the service description to subscribe to `myTopic`
subServiceDescription.add(new QueueExtension({
  subscriptions: [new TopicSubscription({
    topic: myTopic,
  }],
}));

// Create the `Worker` Service
new Service(this, 'Worker', {
  environment: environment,
  serviceDescription: subServiceDescription,
});

Community Extensions

We encourage the development of Community Service Extensions that support advanced features. Here are some useful extensions that we have reviewed:

Please submit a pull request so that we can review your service extension and list it here.

Documentation

Overview

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

The CDK Construct Library that helps you build ECS services using simple extensions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environment_IsConstruct

func Environment_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func ImportedEnvironment_IsConstruct

func ImportedEnvironment_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func NewAliasedPortExtension_Override

func NewAliasedPortExtension_Override(a AliasedPortExtension, props *AliasedPortProps)

Experimental.

func NewAliasedPortMutatingHook_Override

func NewAliasedPortMutatingHook_Override(a AliasedPortMutatingHook, props *AliasedPortMutatingHookProps)

Experimental.

func NewAppMeshExtension_Override

func NewAppMeshExtension_Override(a AppMeshExtension, props *MeshProps)

Experimental.

func NewAssignPublicIpExtension_Override

func NewAssignPublicIpExtension_Override(a AssignPublicIpExtension, options *AssignPublicIpExtensionOptions)

Experimental.

func NewCloudwatchAgentExtension_Override

func NewCloudwatchAgentExtension_Override(c CloudwatchAgentExtension)

Experimental.

func NewContainerMutatingHook_Override

func NewContainerMutatingHook_Override(c ContainerMutatingHook)

Experimental.

func NewContainer_Override

func NewContainer_Override(c Container, props *ContainerExtensionProps)

Experimental.

func NewEnvironment_Override

func NewEnvironment_Override(e Environment, scope constructs.Construct, id *string, props *EnvironmentProps)

Experimental.

func NewFireLensExtension_Override

func NewFireLensExtension_Override(f FireLensExtension)

Experimental.

func NewFirelensMutatingHook_Override

func NewFirelensMutatingHook_Override(f FirelensMutatingHook, props *FirelensProps)

Experimental.

func NewHttpLoadBalancerExtension_Override

func NewHttpLoadBalancerExtension_Override(h HttpLoadBalancerExtension, props *HttpLoadBalancerProps)

Experimental.

func NewImportedEnvironment_Override

func NewImportedEnvironment_Override(i ImportedEnvironment, scope constructs.Construct, id *string, props *EnvironmentAttributes)

Experimental.

func NewInjectableTopic_Override

func NewInjectableTopic_Override(i InjectableTopic, props *InjectableTopicProps)

Experimental.

func NewInjecterExtension_Override

func NewInjecterExtension_Override(i InjecterExtension, props *InjecterExtensionProps)

Experimental.

func NewQueueExtension_Override

func NewQueueExtension_Override(q QueueExtension, props *QueueExtensionProps)

Experimental.

func NewScaleOnCpuUtilization_Override deprecated

func NewScaleOnCpuUtilization_Override(s ScaleOnCpuUtilization, props *CpuScalingProps)

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 .

func NewServiceDescription_Override

func NewServiceDescription_Override(s ServiceDescription)

Experimental.

func NewServiceExtension_Override

func NewServiceExtension_Override(s ServiceExtension, name *string)

Experimental.

func NewService_Override

func NewService_Override(s Service, scope constructs.Construct, id *string, props *ServiceProps)

Experimental.

func NewTopicSubscription_Override

func NewTopicSubscription_Override(t TopicSubscription, props *TopicSubscriptionProps)

Experimental.

func NewXRayExtension_Override

func NewXRayExtension_Override(x XRayExtension)

Experimental.

func Service_IsConstruct

func Service_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

Types

type AliasedPortExtension

type AliasedPortExtension interface {
	ServiceExtension
	// Experimental.
	Alias() *string
	// Experimental.
	SetAlias(val *string)
	// Experimental.
	AliasPort() *float64
	// Experimental.
	SetAliasPort(val *float64)
	// Experimental.
	AppProtocol() awsecs.AppProtocol
	// Experimental.
	SetAppProtocol(val awsecs.AppProtocol)
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// Experimental.
	Namespace() *string
	// Experimental.
	SetNamespace(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

Experimental.

func NewAliasedPortExtension

func NewAliasedPortExtension(props *AliasedPortProps) AliasedPortExtension

Experimental.

type AliasedPortMutatingHook

type AliasedPortMutatingHook interface {
	ContainerMutatingHook
	// 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.
	// Experimental.
	MutateContainerDefinition(props *awsecs.ContainerDefinitionOptions) *awsecs.ContainerDefinitionOptions
}

This hook modifies the application container's settings so that its primary port mapping has a name. Experimental.

func NewAliasedPortMutatingHook

func NewAliasedPortMutatingHook(props *AliasedPortMutatingHookProps) AliasedPortMutatingHook

Experimental.

type AliasedPortMutatingHookProps

type AliasedPortMutatingHookProps struct {
	// The port on the container which receives traffic.
	//
	// This is the same as the `containerPort` property of port mapping.
	// Experimental.
	AliasPort *float64 `field:"required" json:"aliasPort" yaml:"aliasPort"`
	// The name by which to refer to this port mapping.
	// Experimental.
	PortMappingName *string `field:"required" json:"portMappingName" yaml:"portMappingName"`
	// The protocol which this port mapping expects to receive.
	// Experimental.
	Protocol awsecs.AppProtocol `field:"optional" json:"protocol" yaml:"protocol"`
}

Experimental.

type AliasedPortProps

type AliasedPortProps struct {
	// The DNS alias to advertise for downstream clients.
	// Experimental.
	Alias *string `field:"required" json:"alias" yaml:"alias"`
	// The traffic port for clients to use to connect to the DNS alias.
	// Experimental.
	AliasPort *float64 `field:"optional" json:"aliasPort" yaml:"aliasPort"`
	// The protocol to use over the specified port.
	//
	// May be one of HTTP, HTTP2, or GRPC.
	// Experimental.
	AppProtocol awsecs.AppProtocol `field:"optional" json:"appProtocol" yaml:"appProtocol"`
}

AliasedPortProps defines the properties of an aliased port extension. Experimental.

type AppMeshExtension

type AppMeshExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// The protocol used for AppMesh routing.
	//
	// default - Protocol.HTTP
	// Experimental.
	Protocol() Protocol
	// Experimental.
	Route() awsappmesh.Route
	// Experimental.
	SetRoute(val awsappmesh.Route)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// Experimental.
	VirtualNode() awsappmesh.VirtualNode
	// Experimental.
	SetVirtualNode(val awsappmesh.VirtualNode)
	// Experimental.
	VirtualRouter() awsappmesh.VirtualRouter
	// Experimental.
	SetVirtualRouter(val awsappmesh.VirtualRouter)
	// Experimental.
	VirtualService() awsappmesh.VirtualService
	// Experimental.
	SetVirtualService(val awsappmesh.VirtualService)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(otherService Service, _connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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 `<service name>.<environment name>`. 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`. Experimental.

func NewAppMeshExtension

func NewAppMeshExtension(props *MeshProps) AppMeshExtension

Experimental.

type AssignPublicIpDnsOptions

type AssignPublicIpDnsOptions struct {
	// Name of the record to add to the zone and in which to add the task IP addresses to.
	//
	// Example:
	//   'myservice'
	//
	// Experimental.
	RecordName *string `field:"required" json:"recordName" yaml:"recordName"`
	// A DNS Zone to expose task IPs in.
	// Experimental.
	Zone awsroute53.IHostedZone `field:"required" json:"zone" yaml:"zone"`
}

Experimental.

type AssignPublicIpExtension

type AssignPublicIpExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// Experimental.
	Dns() *AssignPublicIpDnsOptions
	// Experimental.
	SetDns(val *AssignPublicIpDnsOptions)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, _scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

func NewAssignPublicIpExtension

func NewAssignPublicIpExtension(options *AssignPublicIpExtensionOptions) AssignPublicIpExtension

Experimental.

type AssignPublicIpExtensionOptions

type AssignPublicIpExtensionOptions struct {
	// 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.
	// Experimental.
	Dns *AssignPublicIpDnsOptions `field:"optional" json:"dns" yaml:"dns"`
}

Experimental.

type AutoScalingOptions

type AutoScalingOptions struct {
	// The maximum number of tasks when scaling out.
	// Experimental.
	MaxTaskCount *float64 `field:"required" json:"maxTaskCount" yaml:"maxTaskCount"`
	// The minimum number of tasks when scaling in.
	// Experimental.
	MinTaskCount *float64 `field:"optional" json:"minTaskCount" yaml:"minTaskCount"`
	// The target value for CPU utilization across all tasks in the service.
	// Experimental.
	TargetCpuUtilization *float64 `field:"optional" json:"targetCpuUtilization" yaml:"targetCpuUtilization"`
	// The target value for memory utilization across all tasks in the service.
	// Experimental.
	TargetMemoryUtilization *float64 `field:"optional" json:"targetMemoryUtilization" yaml:"targetMemoryUtilization"`
}

Experimental.

type CloudwatchAgentExtension

type CloudwatchAgentExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

This extension adds a CloudWatch agent to the task definition and configures the task to be able to publish metrics to CloudWatch. Experimental.

func NewCloudwatchAgentExtension

func NewCloudwatchAgentExtension() CloudwatchAgentExtension

Experimental.

type ConnectToProps

type ConnectToProps struct {
	// 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.
	// Experimental.
	LocalBindPort *float64 `field:"optional" json:"localBindPort" yaml:"localBindPort"`
}

connectToProps will have all the extra parameters which are required for connecting services. Experimental.

type Container

type Container interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The log group into which application container logs should be routed.
	// Experimental.
	LogGroup() awslogs.ILogGroup
	// Experimental.
	SetLogGroup(val awslogs.ILogGroup)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// The port on which the container expects to receive network traffic.
	// Experimental.
	TrafficPort() *float64
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

func NewContainer

func NewContainer(props *ContainerExtensionProps) Container

Experimental.

type ContainerExtensionProps

type ContainerExtensionProps struct {
	// How much CPU the container requires.
	// Experimental.
	Cpu *float64 `field:"required" json:"cpu" yaml:"cpu"`
	// The image to run.
	// Experimental.
	Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"`
	// How much memory in megabytes the container requires.
	// Experimental.
	MemoryMiB *float64 `field:"required" json:"memoryMiB" yaml:"memoryMiB"`
	// What port the image listen for traffic on.
	// Experimental.
	TrafficPort *float64 `field:"required" json:"trafficPort" yaml:"trafficPort"`
	// Environment variables to pass into the container.
	// Experimental.
	Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
	// The environment files to pass to the container.
	// See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html
	//
	// Experimental.
	EnvironmentFiles *[]awsecs.EnvironmentFile `field:"optional" json:"environmentFiles" yaml:"environmentFiles"`
	// The log group into which application container logs should be routed.
	// Experimental.
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// The secret environment variables to pass to the container.
	// Experimental.
	Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"`
}

Setting for the main application container of a service. Experimental.

type ContainerMutatingHook

type ContainerMutatingHook interface {
	// 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.
	// Experimental.
	MutateContainerDefinition(props *awsecs.ContainerDefinitionOptions) *awsecs.ContainerDefinitionOptions
}

This is an abstract class wrapper for a mutating hook.

It is extended by any extension which wants to mutate other extension's containers. Experimental.

type CpuScalingProps

type CpuScalingProps struct {
	// How many tasks to launch initially.
	// 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 .
	InitialTaskCount *float64 `field:"optional" json:"initialTaskCount" yaml:"initialTaskCount"`
	// The maximum number of tasks when scaling out.
	// 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 .
	MaxTaskCount *float64 `field:"optional" json:"maxTaskCount" yaml:"maxTaskCount"`
	// The minimum number of tasks when scaling in.
	// 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 .
	MinTaskCount *float64 `field:"optional" json:"minTaskCount" yaml:"minTaskCount"`
	// How long to wait between scale in actions.
	// 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 .
	ScaleInCooldown awscdk.Duration `field:"optional" json:"scaleInCooldown" yaml:"scaleInCooldown"`
	// How long to wait between scale out actions.
	// 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 .
	ScaleOutCooldown awscdk.Duration `field:"optional" json:"scaleOutCooldown" yaml:"scaleOutCooldown"`
	// The CPU utilization to try ot maintain.
	// 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 .
	TargetCpuUtilization *float64 `field:"optional" json:"targetCpuUtilization" yaml:"targetCpuUtilization"`
}

The autoscaling settings. 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 .

type Environment

type Environment interface {
	constructs.Construct
	IEnvironment
	// The capacity type used by the service's cluster.
	// Experimental.
	CapacityType() EnvironmentCapacityType
	// The cluster that is providing capacity for this service.
	// Experimental.
	Cluster() awsecs.ICluster
	// The name of this environment.
	// Experimental.
	Id() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// The VPC where environment services should be placed.
	// Experimental.
	Vpc() awsec2.IVpc
	// Add a default cloudmap namespace to the environment's cluster.
	//
	// The environment's cluster must not be imported.
	// Experimental.
	AddDefaultCloudMapNamespace(options *awsecs.CloudMapNamespaceOptions)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

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. Experimental.

func NewEnvironment

func NewEnvironment(scope constructs.Construct, id *string, props *EnvironmentProps) Environment

Experimental.

type EnvironmentAttributes

type EnvironmentAttributes struct {
	// The capacity type used by the service's cluster.
	// Experimental.
	CapacityType EnvironmentCapacityType `field:"required" json:"capacityType" yaml:"capacityType"`
	// The cluster that is providing capacity for this service.
	// Experimental.
	Cluster awsecs.ICluster `field:"required" json:"cluster" yaml:"cluster"`
}

Experimental.

type EnvironmentCapacityType

type EnvironmentCapacityType string

The types of capacity that are supported.

These capacity types may change the behavior of an extension. Experimental.

const (
	// Specify that the environment should use AWS Fargate for hosting containers.
	// Experimental.
	EnvironmentCapacityType_FARGATE EnvironmentCapacityType = "FARGATE"
	// Specify that the environment should launch containers onto EC2 instances.
	// Experimental.
	EnvironmentCapacityType_EC2 EnvironmentCapacityType = "EC2"
)

type EnvironmentProps

type EnvironmentProps struct {
	// The type of capacity to use for this environment.
	// Experimental.
	CapacityType EnvironmentCapacityType `field:"optional" json:"capacityType" yaml:"capacityType"`
	// The ECS cluster which provides compute capacity to this service.
	//
	// [disable-awslint:ref-via-interface].
	// Experimental.
	Cluster awsecs.Cluster `field:"optional" json:"cluster" yaml:"cluster"`
	// The VPC used by the service for networking.
	// Experimental.
	Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
}

Settings for the environment where you want to deploy your services. Experimental.

type FireLensExtension

type FireLensExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

func NewFireLensExtension

func NewFireLensExtension() FireLensExtension

Experimental.

type FirelensMutatingHook

type FirelensMutatingHook interface {
	ContainerMutatingHook
	// 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.
	// Experimental.
	MutateContainerDefinition(props *awsecs.ContainerDefinitionOptions) *awsecs.ContainerDefinitionOptions
}

This hook modifies the application container's settings so that it routes logs using FireLens. Experimental.

func NewFirelensMutatingHook

func NewFirelensMutatingHook(props *FirelensProps) FirelensMutatingHook

Experimental.

type FirelensProps

type FirelensProps struct {
	// The log group into which logs should be routed.
	// Experimental.
	LogGroup awslogs.LogGroup `field:"required" json:"logGroup" yaml:"logGroup"`
	// The parent service that is being mutated.
	// Experimental.
	ParentService Service `field:"required" json:"parentService" yaml:"parentService"`
}

Settings for the hook which mutates the application container to route logs through FireLens. Experimental.

type HttpLoadBalancerExtension

type HttpLoadBalancerExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

This extension add a public facing load balancer for sending traffic to one or more replicas of the application container. Experimental.

func NewHttpLoadBalancerExtension

func NewHttpLoadBalancerExtension(props *HttpLoadBalancerProps) HttpLoadBalancerExtension

Experimental.

type HttpLoadBalancerProps

type HttpLoadBalancerProps struct {
	// The number of ALB requests per target.
	// Experimental.
	RequestsPerTarget *float64 `field:"optional" json:"requestsPerTarget" yaml:"requestsPerTarget"`
}

Experimental.

type IEnvironment

type IEnvironment interface {
	// Add a default cloudmap namespace to the environment's cluster.
	// Experimental.
	AddDefaultCloudMapNamespace(options *awsecs.CloudMapNamespaceOptions)
	// The capacity type used by the service's cluster.
	// Experimental.
	CapacityType() EnvironmentCapacityType
	// The cluster that is providing capacity for this service.
	// Experimental.
	Cluster() awsecs.ICluster
	// The name of this environment.
	// Experimental.
	Id() *string
	// The VPC into which environment services should be placed.
	// Experimental.
	Vpc() awsec2.IVpc
}

An environment into which to deploy a service. Experimental.

func Environment_FromEnvironmentAttributes

func Environment_FromEnvironmentAttributes(scope constructs.Construct, id *string, attrs *EnvironmentAttributes) IEnvironment

Import an existing environment from its attributes. Experimental.

type IGrantInjectable

type IGrantInjectable interface {
	IInjectable
	// Experimental.
	Grant(taskDefinition awsecs.TaskDefinition)
}

An interface that will be implemented by all the injectable resources that need to grant permissions to the task role. Experimental.

type IInjectable

type IInjectable interface {
	// Experimental.
	EnvironmentVariables() *map[string]*string
}

An interface that will be implemented by all the resources that can be published events or written data to. Experimental.

type ISubscribable

type ISubscribable interface {
	// All classes implementing this interface must also implement the `subscribe()` method.
	// Experimental.
	Subscribe(extension QueueExtension) awssqs.IQueue
	// The `SubscriptionQueue` object for the `ISubscribable` object.
	// Experimental.
	SubscriptionQueue() *SubscriptionQueue
}

An interface that will be implemented by all the resources that can be subscribed to. Experimental.

type ImportedEnvironment

type ImportedEnvironment interface {
	constructs.Construct
	IEnvironment
	// The capacity type used by the service's cluster.
	// Experimental.
	CapacityType() EnvironmentCapacityType
	// The cluster that is providing capacity for this service.
	// Experimental.
	Cluster() awsecs.ICluster
	// The name of this environment.
	// Experimental.
	Id() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// The VPC into which environment services should be placed.
	// Experimental.
	Vpc() awsec2.IVpc
	// Adding a default cloudmap namespace to the cluster will throw an error, as we don't own it.
	// Experimental.
	AddDefaultCloudMapNamespace(_options *awsecs.CloudMapNamespaceOptions)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Experimental.

func NewImportedEnvironment

func NewImportedEnvironment(scope constructs.Construct, id *string, props *EnvironmentAttributes) ImportedEnvironment

Experimental.

type InjectableTopic

type InjectableTopic interface {
	IGrantInjectable
	// Experimental.
	Topic() awssns.ITopic
	// Experimental.
	EnvironmentVariables() *map[string]*string
	// Experimental.
	Grant(taskDefinition awsecs.TaskDefinition)
}

The `InjectableTopic` class represents SNS Topic resource that can be published events to by the parent service. Experimental.

func NewInjectableTopic

func NewInjectableTopic(props *InjectableTopicProps) InjectableTopic

Experimental.

type InjectableTopicProps

type InjectableTopicProps struct {
	// The SNS Topic to publish events to.
	// Experimental.
	Topic awssns.ITopic `field:"required" json:"topic" yaml:"topic"`
}

The settings for the `InjectableTopic` class. Experimental.

type InjecterExtension

type InjecterExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// Add hooks to the main application extension so that it is modified to add the injectable resource environment variables to the container environment.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// After the task definition has been created, this hook grants the required permissions to the task role for the parent service.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

func NewInjecterExtension

func NewInjecterExtension(props *InjecterExtensionProps) InjecterExtension

Experimental.

type InjecterExtensionProps

type InjecterExtensionProps struct {
	// The list of injectable resources for this service.
	// Experimental.
	Injectables *[]IInjectable `field:"required" json:"injectables" yaml:"injectables"`
}

The settings for the Injecter extension. Experimental.

type MeshProps

type MeshProps struct {
	// The service mesh into which to register the service.
	// Experimental.
	Mesh awsappmesh.Mesh `field:"required" json:"mesh" yaml:"mesh"`
	// The protocol of the service.
	//
	// Valid values are Protocol.HTTP, Protocol.HTTP2, Protocol.TCP, Protocol.GRPC
	// Experimental.
	Protocol Protocol `field:"optional" json:"protocol" yaml:"protocol"`
}

The settings for the App Mesh extension. Experimental.

type Protocol

type Protocol string

Enum of supported AppMesh protocols. Experimental.

const (
	// Experimental.
	Protocol_HTTP Protocol = "HTTP"
	// Experimental.
	Protocol_TCP Protocol = "TCP"
	// Experimental.
	Protocol_HTTP2 Protocol = "HTTP2"
	// Experimental.
	Protocol_GRPC Protocol = "GRPC"
)

type QueueAutoScalingOptions

type QueueAutoScalingOptions struct {
	// Acceptable amount of time a message can sit in the queue (including the time required to process it).
	// Experimental.
	AcceptableLatency awscdk.Duration `field:"required" json:"acceptableLatency" yaml:"acceptableLatency"`
	// Average amount of time for processing a single message in the queue.
	// Experimental.
	MessageProcessingTime awscdk.Duration `field:"required" json:"messageProcessingTime" yaml:"messageProcessingTime"`
}

Options for configuring SQS Queue auto scaling. Experimental.

type QueueExtension

type QueueExtension interface {
	ServiceExtension
	// Experimental.
	AutoscalingOptions() *QueueAutoScalingOptions
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// Experimental.
	EventsQueue() awssqs.IQueue
	// The log group created by the extension where the AWS Lambda function logs are stored.
	// Experimental.
	LogGroup() awslogs.ILogGroup
	// Experimental.
	SetLogGroup(val awslogs.ILogGroup)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// Add hooks to the main application extension so that it is modified to add the events queue URL to the container environment.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// This hook creates (if required) and sets the default queue `eventsQueue`.
	//
	// It also sets up the subscriptions for
	// the provided `ISubscribable` objects.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// After the task definition has been created, this hook grants SQS permissions to the task role.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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 `<extension>.eventsQueue`. Experimental.

func NewQueueExtension

func NewQueueExtension(props *QueueExtensionProps) QueueExtension

Experimental.

type QueueExtensionProps

type QueueExtensionProps struct {
	// The user-provided default queue for this service.
	//
	// If the `eventsQueue` is not provided, a default SQS Queue is created for the service.
	// Experimental.
	EventsQueue awssqs.IQueue `field:"optional" json:"eventsQueue" yaml:"eventsQueue"`
	// The user-provided queue delay fields to configure auto scaling for the default queue.
	// Experimental.
	ScaleOnLatency *QueueAutoScalingOptions `field:"optional" json:"scaleOnLatency" yaml:"scaleOnLatency"`
	// The list of subscriptions for this service.
	// Experimental.
	Subscriptions *[]ISubscribable `field:"optional" json:"subscriptions" yaml:"subscriptions"`
}

The settings for the Queue extension. Experimental.

type ScaleOnCpuUtilization

type ScaleOnCpuUtilization interface {
	ServiceExtension
	// 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.
	// 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 .
	Container() awsecs.ContainerDefinition
	// 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 .
	SetContainer(val awsecs.ContainerDefinition)
	// 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 .
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// 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 .
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// How many tasks to launch initially.
	// 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 .
	InitialTaskCount() *float64
	// The maximum number of tasks when scaling out.
	// 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 .
	MaxTaskCount() *float64
	// The minimum number of tasks when scaling in.
	// 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 .
	MinTaskCount() *float64
	// The name of the extension.
	// 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 .
	Name() *string
	// 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 .
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// 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 .
	ParentService() Service
	// 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 .
	SetParentService(val Service)
	// How long to wait between scale in actions.
	// 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 .
	ScaleInCooldown() awscdk.Duration
	// How long to wait between scale out actions.
	// 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 .
	ScaleOutCooldown() awscdk.Duration
	// 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 .
	Scope() constructs.Construct
	// 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 .
	SetScope(val constructs.Construct)
	// The CPU utilization to try ot maintain.
	// 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 .
	TargetCpuUtilization() *float64
	// 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.
	// 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 .
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// 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 .
	AddHooks()
	// 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.
	// 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 .
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// 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 .
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// 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 .
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// 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 .
	Prehook(parent Service, scope constructs.Construct)
	// 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.
	// 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 .
	ResolveContainerDependencies()
	// 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.
	// 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 .
	UseService(service interface{})
	// 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.
	// 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 .
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

This extension helps you scale your service according to CPU utilization. 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 .

func NewScaleOnCpuUtilization deprecated

func NewScaleOnCpuUtilization(props *CpuScalingProps) ScaleOnCpuUtilization

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 .

type Service

type Service interface {
	constructs.Construct
	// The capacity type that this service will use.
	//
	// Valid values are EC2 or FARGATE.
	// Experimental.
	CapacityType() EnvironmentCapacityType
	// The cluster that is providing capacity for this service.
	//
	// [disable-awslint:ref-via-interface].
	// Experimental.
	Cluster() awsecs.ICluster
	// The underlying ECS service that was created.
	// Experimental.
	EcsService() interface{}
	// Experimental.
	SetEcsService(val interface{})
	// The environment where this service was launched.
	// Experimental.
	Environment() IEnvironment
	// The name of the service.
	// Experimental.
	Id() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// The scalable attribute representing task count.
	// Experimental.
	ScalableTaskCount() awsecs.ScalableTaskCount
	// The ServiceDescription used to build this service.
	// Experimental.
	ServiceDescription() ServiceDescription
	// The application target group if the service has an HTTPLoadBalancerExtension.
	// Experimental.
	TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup
	// Experimental.
	SetTargetGroup(val awselasticloadbalancingv2.ApplicationTargetGroup)
	// The generated task definition for this service.
	//
	// It is only
	// generated after .prepare() has been executed.
	// Experimental.
	TaskDefinition() awsecs.TaskDefinition
	// Experimental.
	SetTaskDefinition(val awsecs.TaskDefinition)
	// The VPC where this service should be placed.
	// Experimental.
	Vpc() awsec2.IVpc
	// 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.
	// Experimental.
	AddURL(urlName *string, url *string)
	// Tell extensions from one service to connect to extensions from another sevice if they have implemented a hook for it.
	// Experimental.
	ConnectTo(service Service, connectToProps *ConnectToProps)
	// This helper method is used to set the `autoScalingPoliciesEnabled` attribute whenever an auto scaling policy is configured for the service.
	// Experimental.
	EnableAutoScalingPolicy()
	// Retrieve a URL for the service.
	//
	// The URL must have previously been
	// stored by one of the URL providing extensions.
	// Experimental.
	GetURL(urlName *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

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. Experimental.

func NewService

func NewService(scope constructs.Construct, id *string, props *ServiceProps) Service

Experimental.

type ServiceBuild

type ServiceBuild struct {
	// The cluster in which to launch the service.
	// Experimental.
	Cluster awsecs.ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The task definition registered to this service.
	// Experimental.
	TaskDefinition awsecs.TaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"`
	// Specifies whether the task's elastic network interface receives a public IP address.
	//
	// If true, each task will receive a public IP address.
	// Experimental.
	AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"`
	// Configuration for how to register the service in service discovery.
	// Experimental.
	CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"`
	// How many tasks to run.
	// Experimental.
	DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"`
	// 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.
	// Experimental.
	HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"`
	// Maximum percentage of tasks that can be launched.
	// Experimental.
	MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"`
	// Minimum healthy task percentage.
	// Experimental.
	MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"`
	// Configuration for service connect for this service.
	// Experimental.
	ServiceConnectConfiguration *awsecs.ServiceConnectProps `field:"optional" json:"serviceConnectConfiguration" yaml:"serviceConnectConfiguration"`
}

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. Experimental.

type ServiceDescription

type ServiceDescription interface {
	// The list of extensions that have been registered to run when preparing this service.
	// Experimental.
	Extensions() *map[string]ServiceExtension
	// Experimental.
	SetExtensions(val *map[string]ServiceExtension)
	// Adds a new extension to the service.
	//
	// The extensions mutate a service
	// to add resources to or configure properties for the service.
	// Experimental.
	Add(extension ServiceExtension) ServiceDescription
	// Get the extension with a specific name.
	//
	// This is generally used by
	// extensions in order to discover each other.
	// Experimental.
	Get(name *string) ServiceExtension
}

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. Experimental.

func NewServiceDescription

func NewServiceDescription() ServiceDescription

Experimental.

type ServiceExtension

type ServiceExtension interface {
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(parent Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

type ServiceProps

type ServiceProps struct {
	// The environment to launch the service in.
	// Experimental.
	Environment IEnvironment `field:"required" json:"environment" yaml:"environment"`
	// The ServiceDescription used to build the service.
	// Experimental.
	ServiceDescription ServiceDescription `field:"required" json:"serviceDescription" yaml:"serviceDescription"`
	// The options for configuring the auto scaling target.
	// Experimental.
	AutoScaleTaskCount *AutoScalingOptions `field:"optional" json:"autoScaleTaskCount" yaml:"autoScaleTaskCount"`
	// The desired number of instantiations of the task definition to keep running on the service.
	// Experimental.
	DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"`
	// The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
	// Experimental.
	TaskRole awsiam.IRole `field:"optional" json:"taskRole" yaml:"taskRole"`
}

The settings for an ECS Service. Experimental.

type SubscriptionQueue

type SubscriptionQueue struct {
	// The user-provided queue to subscribe to the given topic.
	// Experimental.
	Queue awssqs.IQueue `field:"required" json:"queue" yaml:"queue"`
	// The user-provided queue delay fields to configure auto scaling for the topic-specific queue.
	// Experimental.
	ScaleOnLatency *QueueAutoScalingOptions `field:"optional" json:"scaleOnLatency" yaml:"scaleOnLatency"`
}

`SubscriptionQueue` represents the subscription queue object which includes the topic-specific queue and its corresponding auto scaling fields. Experimental.

type TopicSubscription

type TopicSubscription interface {
	ISubscribable
	// The queue that subscribes to the given topic.
	// Deprecated: use `subscriptionQueue`.
	Queue() awssqs.IQueue
	// The subscription queue object for this subscription.
	// Experimental.
	SubscriptionQueue() *SubscriptionQueue
	// Experimental.
	Topic() awssns.ITopic
	// 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.
	//
	// Returns: the queue subscribed to the given topic.
	// Experimental.
	Subscribe(extension QueueExtension) awssqs.IQueue
}

The `TopicSubscription` class represents an SNS Topic resource that can be subscribed to by the service queues. Experimental.

func NewTopicSubscription

func NewTopicSubscription(props *TopicSubscriptionProps) TopicSubscription

Experimental.

type TopicSubscriptionProps

type TopicSubscriptionProps struct {
	// The SNS Topic to subscribe to.
	// Experimental.
	Topic awssns.ITopic `field:"required" json:"topic" yaml:"topic"`
	// The user-provided queue to subscribe to the given topic.
	// Deprecated: use `topicSubscriptionQueue`.
	Queue awssqs.IQueue `field:"optional" json:"queue" yaml:"queue"`
	// 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.
	// Experimental.
	TopicSubscriptionQueue *SubscriptionQueue `field:"optional" json:"topicSubscriptionQueue" yaml:"topicSubscriptionQueue"`
}

The topic-specific settings for creating the queue subscriptions. Experimental.

type XRayExtension

type XRayExtension interface {
	ServiceExtension
	// 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.
	// Experimental.
	Container() awsecs.ContainerDefinition
	// Experimental.
	SetContainer(val awsecs.ContainerDefinition)
	// Experimental.
	ContainerMutatingHooks() *[]ContainerMutatingHook
	// Experimental.
	SetContainerMutatingHooks(val *[]ContainerMutatingHook)
	// The name of the extension.
	// Experimental.
	Name() *string
	// Experimental.
	SetName(val *string)
	// The service which this extension is being added to.
	//
	// Initially, extensions are collected into a ServiceDescription, but no service
	// exists yet. Later, when the ServiceDescription is used to create a service,
	// the extension is told what Service it is now working on.
	// Experimental.
	ParentService() Service
	// Experimental.
	SetParentService(val Service)
	// Experimental.
	Scope() constructs.Construct
	// Experimental.
	SetScope(val constructs.Construct)
	// 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.
	// Experimental.
	AddContainerMutatingHook(hook ContainerMutatingHook)
	// A hook that allows the extension to add hooks to other extensions that are registered.
	// Experimental.
	AddHooks()
	// 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.
	// Experimental.
	ConnectToService(service Service, connectToProps *ConnectToProps)
	// 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.
	// Experimental.
	ModifyServiceProps(props *ServiceBuild) *ServiceBuild
	// 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.
	// Experimental.
	ModifyTaskDefinitionProps(props *awsecs.TaskDefinitionProps) *awsecs.TaskDefinitionProps
	// A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
	// Experimental.
	Prehook(service Service, scope constructs.Construct)
	// 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.
	// Experimental.
	ResolveContainerDependencies()
	// 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.
	// Experimental.
	UseService(service interface{})
	// 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.
	// Experimental.
	UseTaskDefinition(taskDefinition awsecs.TaskDefinition)
}

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. Experimental.

func NewXRayExtension

func NewXRayExtension() XRayExtension

Experimental.

Source Files

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL