agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

View File

@@ -0,0 +1,93 @@
import type { Construct } from 'constructs';
import type { NetworkMode } from './task-definition';
import { Compatibility } from './task-definition';
import type { IRole } from '../../../aws-iam';
import { Resource } from '../../../core';
import type { IEc2TaskDefinition } from '../ec2/ec2-task-definition';
import type { TaskDefinitionReference } from '../ecs.generated';
import type { IFargateTaskDefinition } from '../fargate/fargate-task-definition';
/**
* The properties of ImportedTaskDefinition
*/
export interface ImportedTaskDefinitionProps {
/**
* The arn of the task definition
*/
readonly taskDefinitionArn: string;
/**
* What launch types this task definition should be compatible with.
*
* @default Compatibility.EC2_AND_FARGATE
*/
readonly compatibility?: Compatibility;
/**
* The networking mode to use for the containers in the task.
*
* @default Network mode cannot be provided to the imported task.
*/
readonly networkMode?: NetworkMode;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*
* @default Permissions cannot be granted to the imported task.
*/
readonly taskRole?: IRole;
/**
* The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.
*
* Some tasks do not have an execution role.
*
* @default - undefined
*/
readonly executionRole?: IRole;
}
/**
* Task definition reference of an imported task
*/
export declare class ImportedTaskDefinition extends Resource implements IEc2TaskDefinition, IFargateTaskDefinition {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* What launch types this task definition should be compatible with.
*/
readonly compatibility: Compatibility;
/**
* ARN of this task definition
*/
readonly taskDefinitionArn: string;
/**
* Execution role for this task definition
*/
readonly executionRole?: IRole;
/**
* The networking mode to use for the containers in the task.
*/
readonly _networkMode?: NetworkMode;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*/
readonly _taskRole?: IRole;
constructor(scope: Construct, id: string, props: ImportedTaskDefinitionProps);
get networkMode(): NetworkMode;
get taskRole(): IRole;
/**
* Return true if the task definition can be run on an EC2 cluster
*/
get isEc2Compatible(): boolean;
/**
* Return true if the task definition can be run on a Fargate cluster
*/
get isFargateCompatible(): boolean;
/**
* Return true if the task definition can be run on a ECS Anywhere cluster
*/
get isExternalCompatible(): boolean;
/**
* Return true if the task definition can be run on Managed Instances
*/
get isManagedInstancesCompatible(): boolean;
/**
* A reference to this task definition.
*/
get taskDefinitionRef(): TaskDefinitionReference;
}

View File

@@ -0,0 +1 @@
"use strict";var __esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ImportedTaskDefinition=void 0;var task_definition_1=()=>{var tmp=require("./task-definition");return task_definition_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let ImportedTaskDefinition=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var ImportedTaskDefinition2=class extends _classSuper{static{_classThis=this}static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ImportedTaskDefinition2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-ecs.ImportedTaskDefinition";compatibility;taskDefinitionArn;executionRole=void 0;_networkMode;_taskRole;constructor(scope,id,props){super(scope,id),(0,metadata_resource_1().addConstructMetadata)(this,props),this.compatibility=props.compatibility??task_definition_1().Compatibility.EC2_AND_FARGATE,this.taskDefinitionArn=props.taskDefinitionArn,this.executionRole=props.executionRole,this._taskRole=props.taskRole,this._networkMode=props.networkMode}get networkMode(){if(this._networkMode==null)throw new(core_1()).ValidationError((0,literal_string_1().lit)`NetworkModeRequired`,"This operation requires the networkMode in ImportedTaskDefinition to be defined. Add the 'networkMode' in ImportedTaskDefinitionProps to instantiate ImportedTaskDefinition",this);return this._networkMode}get taskRole(){if(this._taskRole==null)throw new(core_1()).ValidationError((0,literal_string_1().lit)`TaskRoleRequired`,"This operation requires the taskRole in ImportedTaskDefinition to be defined. Add the 'taskRole' in ImportedTaskDefinitionProps to instantiate ImportedTaskDefinition",this);return this._taskRole}get isEc2Compatible(){return(0,task_definition_1().isEc2Compatible)(this.compatibility)}get isFargateCompatible(){return(0,task_definition_1().isFargateCompatible)(this.compatibility)}get isExternalCompatible(){return(0,task_definition_1().isExternalCompatible)(this.compatibility)}get isManagedInstancesCompatible(){return(0,task_definition_1().isManagedInstancesCompatible)(this.compatibility)}get taskDefinitionRef(){return{taskDefinitionArn:this.taskDefinitionArn}}static{__runInitializers(_classThis,_classExtraInitializers)}};return ImportedTaskDefinition2=_classThis})();exports.ImportedTaskDefinition=ImportedTaskDefinition;

View File

@@ -0,0 +1,955 @@
import type { Construct } from 'constructs';
import { ScalableTaskCount } from './scalable-task-count';
import type { ServiceManagedVolume } from './service-managed-volume';
import * as appscaling from '../../../aws-applicationautoscaling';
import * as cloudwatch from '../../../aws-cloudwatch';
import * as ec2 from '../../../aws-ec2';
import type * as elb from '../../../aws-elasticloadbalancing';
import * as elbv2 from '../../../aws-elasticloadbalancingv2';
import * as iam from '../../../aws-iam';
import type * as kms from '../../../aws-kms';
import * as cloudmap from '../../../aws-servicediscovery';
import type { IResource } from '../../../core';
import { Duration, Resource } from '../../../core';
import type { IServiceRef, ServiceReference } from '../../../interfaces/generated/aws-ecs-interfaces.generated';
import type { LoadBalancerTargetOptions, TaskDefinition } from '../base/task-definition';
import { TaskDefinitionRevision } from '../base/task-definition';
import type { CapacityProviderStrategy, ICluster } from '../cluster';
import type { ContainerDefinition, Protocol } from '../container-definition';
import type { IDeploymentLifecycleHookTarget } from '../deployment-lifecycle-hook-target';
import { CfnService } from '../ecs.generated';
import type { LogDriver } from '../log-drivers/log-driver';
/**
* The interface for a service.
*/
export interface IService extends IResource, IServiceRef {
/**
* The Amazon Resource Name (ARN) of the service.
*
* @attribute
*/
readonly serviceArn: string;
/**
* The name of the service.
*
* @attribute
*/
readonly serviceName: string;
}
/**
* The deployment controller to use for the service.
*/
export interface DeploymentController {
/**
* The deployment controller type to use.
*
* @default DeploymentControllerType.ECS
*/
readonly type?: DeploymentControllerType;
}
/**
* The deployment circuit breaker to use for the service
*/
export interface DeploymentCircuitBreaker {
/**
* Whether to enable the deployment circuit breaker logic
* @default true
*/
readonly enable?: boolean;
/**
* Whether to enable rollback on deployment failure
*
* @default false
*/
readonly rollback?: boolean;
}
/**
* Configuration for traffic shift during progressive deployments
*/
export interface TrafficShiftConfig {
/**
* The percentage of production traffic to shift in each step.
* - For linear deployment: multiples of 0.1 from 3.0 to 100.0
* - For canary deployment: multiples of 0.1 from 0.1 to 100.0
*
* @default - 10.0 for linear, 5.0 for canary
*/
readonly stepPercent?: number;
/**
* The duration to wait between traffic shifting steps.
* Valid values are 0 to 1440 minutes (24 hours).
*
* @default - Duration.minutes(6) for linear, Duration.minutes(10) for canary
*/
readonly stepBakeTime?: Duration;
}
/**
* Deployment behavior when an ECS Service Deployment Alarm is triggered
*/
export declare enum AlarmBehavior {
/**
* ROLLBACK_ON_ALARM causes the service to roll back to the previous deployment
* when any deployment alarm enters the 'Alarm' state. The Cloudformation stack
* will be rolled back and enter state "UPDATE_ROLLBACK_COMPLETE".
*/
ROLLBACK_ON_ALARM = "ROLLBACK_ON_ALARM",
/**
* FAIL_ON_ALARM causes the deployment to fail immediately when any deployment
* alarm enters the 'Alarm' state. In order to restore functionality, you must
* roll the stack forward by pushing a new version of the ECS service.
*/
FAIL_ON_ALARM = "FAIL_ON_ALARM"
}
/**
* Options for deployment alarms
*/
export interface DeploymentAlarmOptions {
/**
* Default rollback on alarm
* @default AlarmBehavior.ROLLBACK_ON_ALARM
*/
readonly behavior?: AlarmBehavior;
}
/**
* Configuration for deployment alarms
*/
export interface DeploymentAlarmConfig extends DeploymentAlarmOptions {
/**
* List of alarm names to monitor during deployments
*/
readonly alarmNames: string[];
}
export interface EcsTarget {
/**
* The name of the container.
*/
readonly containerName: string;
/**
* The port number of the container. Only applicable when using application/network load balancers.
*
* @default - Container port of the first added port mapping.
*/
readonly containerPort?: number;
/**
* The protocol used for the port mapping. Only applicable when using application load balancers.
*
* @default Protocol.TCP
*/
readonly protocol?: Protocol;
/**
* ID for a target group to be created.
*/
readonly newTargetGroupId: string;
/**
* Listener and properties for adding target group to the listener.
*/
readonly listener: ListenerConfig;
}
/**
* Interface for ECS load balancer target.
*/
export interface IEcsLoadBalancerTarget extends elbv2.IApplicationLoadBalancerTarget, elbv2.INetworkLoadBalancerTarget, elb.ILoadBalancerTarget {
}
/**
* The format of Service Connect access logs.
*
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect-envoy-access-logs.html
*/
export declare enum ServiceConnectAccessLogFormat {
/**
* Human-readable text format for access logs.
*/
TEXT = "TEXT",
/**
* Structured JSON format for access logs.
* This format is well-suited for integration with log analysis tools.
*/
JSON = "JSON"
}
/**
* Configuration for Service Connect access logs.
*
* Service Connect access logs provide detailed telemetry about individual requests processed by the Service Connect proxy,
* including HTTP methods, paths, response codes, and timing information.
*
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect-envoy-access-logs.html
*/
export interface ServiceConnectAccessLogConfiguration {
/**
* The format for Service Connect access log output.
*
* - TEXT: Human-readable text format
* - JSON: Structured JSON format for log analysis tools
*/
readonly format: ServiceConnectAccessLogFormat;
/**
* Whether to include query parameters in Service Connect access logs.
*
* When enabled, query parameters from HTTP requests are included in the access logs.
* Consider security and privacy implications as query parameters may contain sensitive information such as request IDs and tokens.
*
* @default undefined - AWS ECS default is false, which means that query parameters are not included in access logs
*/
readonly includeQueryParameters?: boolean;
}
/**
* Interface for Service Connect configuration.
*/
export interface ServiceConnectProps {
/**
* The cloudmap namespace to register this service into.
*
* @default the cloudmap namespace specified on the cluster.
*/
readonly namespace?: string;
/**
* The list of Services, including a port mapping, terse client alias, and optional intermediate DNS name.
*
* This property may be left blank if the current ECS service does not need to advertise any ports via Service Connect.
*
* @default none
*/
readonly services?: ServiceConnectService[];
/**
* The log driver configuration to use for the Service Connect agent logs.
*
* @default - none
*/
readonly logDriver?: LogDriver;
/**
* The configuration for Service Connect access logs.
*
* Access logs provide detailed telemetry about individual requests processed by the Service Connect proxy.
*
* @default undefined - AWS ECS default is disabled, which means that access logs are not recorded
*/
readonly accessLogConfiguration?: ServiceConnectAccessLogConfiguration;
}
/**
* Interface for service connect Service props.
*/
export interface ServiceConnectService {
/**
* portMappingName specifies which port and protocol combination should be used for this
* service connect service.
*/
readonly portMappingName: string;
/**
* Optionally specifies an intermediate dns name to register in the CloudMap namespace.
* This is required if you wish to use the same port mapping name in more than one service.
*
* @default - port mapping name
*/
readonly discoveryName?: string;
/**
* The terse DNS alias to use for this port mapping in the service connect mesh.
* Service Connect-enabled clients will be able to reach this service at
* http://dnsName:port.
*
* @default - No alias is created. The service is reachable at `portMappingName.namespace:port`.
*/
readonly dnsName?: string;
/**
* The port for clients to use to communicate with this service via Service Connect.
*
* @default the container port specified by the port mapping in portMappingName.
*/
readonly port?: number;
/**
* Optional. The port on the Service Connect agent container to use for traffic ingress to this service.
*
* @default - none
*/
readonly ingressPortOverride?: number;
/**
* The amount of time in seconds a connection for Service Connect will stay active while idle.
*
* A value of 0 can be set to disable `idleTimeout`.
*
* If `idleTimeout` is set to a time that is less than `perRequestTimeout`, the connection will close
* when the `idleTimeout` is reached and not the `perRequestTimeout`.
*
* @default - Duration.minutes(5) for HTTP/HTTP2/GRPC, Duration.hours(1) for TCP.
*/
readonly idleTimeout?: Duration;
/**
* The amount of time waiting for the upstream to respond with a complete response per request for
* Service Connect.
*
* A value of 0 can be set to disable `perRequestTimeout`.
* Can only be set when the `appProtocol` for the application container is HTTP/HTTP2/GRPC.
*
* If `idleTimeout` is set to a time that is less than `perRequestTimeout`, the connection will close
* when the `idleTimeout` is reached and not the `perRequestTimeout`.
*
* @default - Duration.seconds(15)
*/
readonly perRequestTimeout?: Duration;
/**
* A reference to an object that represents a Transport Layer Security (TLS) configuration.
*
* @default - none
*/
readonly tls?: ServiceConnectTlsConfiguration;
}
/**
* TLS configuration for Service Connect service
*/
export interface ServiceConnectTlsConfiguration {
/**
* The ARN of the certificate root authority that secures your service.
*
* @default - none
*/
readonly awsPcaAuthorityArn?: string;
/**
* The KMS key used for encryption and decryption.
*
* @default - none
*/
readonly kmsKey?: kms.IKeyRef;
/**
* The IAM role that's associated with the Service Connect TLS.
*
* @default - none
*/
readonly role?: iam.IRole;
}
/**
* The properties for the base Ec2Service or FargateService service.
*/
export interface BaseServiceOptions {
/**
* The name of the cluster that hosts the service.
*/
readonly cluster: ICluster;
/**
* The desired number of instantiations of the task definition to keep running on the service.
*
* @default - When creating the service, default is 1; when updating the service, default uses
* the current task number.
*/
readonly desiredCount?: number;
/**
* The name of the service.
*
* @default - CloudFormation-generated name.
*/
readonly serviceName?: string;
/**
* The maximum number of tasks, specified as a percentage of the Amazon ECS
* service's DesiredCount value, that can run in a service during a
* deployment.
*
* @default - 100 if daemon, otherwise 200
*/
readonly maxHealthyPercent?: number;
/**
* The minimum number of tasks, specified as a percentage of
* the Amazon ECS service's DesiredCount value, that must
* continue to run and remain healthy during a deployment.
*
* @default - 0 if daemon, otherwise 50
*/
readonly minHealthyPercent?: number;
/**
* The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy
* Elastic Load Balancing target health checks after a task has first started.
*
* @default - defaults to 60 seconds if at least one load balancer is in-use and it is not already set
*/
readonly healthCheckGracePeriod?: Duration;
/**
* The options for configuring an Amazon ECS service to use service discovery.
*
* @default - AWS Cloud Map service discovery is not enabled.
*/
readonly cloudMapOptions?: CloudMapOptions;
/**
* Specifies whether to propagate the tags from the task definition or the service to the tasks in the service
*
* Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE
*
* @default PropagatedTagSource.NONE
*/
readonly propagateTags?: PropagatedTagSource;
/**
* Specifies whether to enable Amazon ECS managed tags for the tasks within the service. For more information, see
* [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html)
*
* @default false
*/
readonly enableECSManagedTags?: boolean;
/**
* Specifies which deployment controller to use for the service. For more information, see
* [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html)
*
* @default - Rolling update (ECS)
*/
readonly deploymentController?: DeploymentController;
/**
* Whether to enable the deployment circuit breaker. If this property is defined, circuit breaker will be implicitly
* enabled.
* @default - disabled
*/
readonly circuitBreaker?: DeploymentCircuitBreaker;
/**
* The alarm(s) to monitor during deployment, and behavior to apply if at least one enters a state of alarm
* during the deployment or bake time.
*
*
* @default - No alarms will be monitored during deployment.
*/
readonly deploymentAlarms?: DeploymentAlarmConfig;
/**
* A list of Capacity Provider strategies used to place a service.
*
* @default - undefined
*
*/
readonly capacityProviderStrategies?: CapacityProviderStrategy[];
/**
* Whether to enable the ability to execute into a container
*
* @default - undefined
*/
readonly enableExecuteCommand?: boolean;
/**
* Configuration for Service Connect.
*
* @default No ports are advertised via Service Connect on this service, and the service
* cannot make requests to other services via Service Connect.
*/
readonly serviceConnectConfiguration?: ServiceConnectProps;
/**
* Revision number for the task definition or `latest` to use the latest active task revision.
*
* @default - Uses the revision of the passed task definition deployed by CloudFormation
*/
readonly taskDefinitionRevision?: TaskDefinitionRevision;
/**
* Configuration details for a volume used by the service. This allows you to specify
* details about the EBS volume that can be attached to ECS tasks.
*
* @default - undefined
*/
readonly volumeConfigurations?: ServiceManagedVolume[];
/**
* The deployment strategy to use for the service.
* @default ROLLING
*/
readonly deploymentStrategy?: DeploymentStrategy;
/**
* bake time minutes for service.
* @default - none
*/
readonly bakeTime?: Duration;
/**
* The lifecycle hooks to execute during deployment stages
* @default - none;
*/
readonly lifecycleHooks?: IDeploymentLifecycleHookTarget[];
/**
* Configuration for linear deployment strategy.
* Only valid when deploymentStrategy is set to LINEAR.
*
* @default - no linear configuration
*/
readonly linearConfiguration?: TrafficShiftConfig;
/**
* Configuration for canary deployment strategy.
* Only valid when deploymentStrategy is set to CANARY.
*
* @default - no canary configuration
*/
readonly canaryConfiguration?: TrafficShiftConfig;
}
/**
* Complete base service properties that are required to be supplied by the implementation
* of the BaseService class.
*/
export interface BaseServiceProps extends BaseServiceOptions {
/**
* The launch type on which to run your service.
*
* LaunchType will be omitted if capacity provider strategies are specified on the service.
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-capacityproviderstrategy
*
* Valid values are: LaunchType.ECS or LaunchType.FARGATE or LaunchType.EXTERNAL
*/
readonly launchType: LaunchType;
}
/**
* Base class for configuring listener when registering targets.
*/
export declare abstract class ListenerConfig {
/**
* Create a config for adding target group to ALB listener.
*/
static applicationListener(listener: elbv2.ApplicationListener, props?: elbv2.AddApplicationTargetsProps): ListenerConfig;
/**
* Create a config for adding target group to NLB listener.
*/
static networkListener(listener: elbv2.NetworkListener, props?: elbv2.AddNetworkTargetsProps): ListenerConfig;
/**
* Create and attach a target group to listener.
*/
abstract addTargets(id: string, target: LoadBalancerTargetOptions, service: BaseService): void;
}
/**
* The interface for BaseService.
*/
export interface IBaseService extends IService {
/**
* The cluster that hosts the service.
*/
readonly cluster: ICluster;
}
/**
* The base class for Ec2Service and FargateService services.
*/
export declare abstract class BaseService extends Resource implements IBaseService, elbv2.IApplicationLoadBalancerTarget, elbv2.INetworkLoadBalancerTarget, elb.ILoadBalancerTarget {
/**
* Import an existing ECS/Fargate Service using the service cluster format.
* The format is the "new" format "arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name".
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids
*/
static fromServiceArnWithCluster(scope: Construct, id: string, serviceArn: string): IBaseService;
private static MIN_PORT;
private static MAX_PORT;
/**
* The security groups which manage the allowed network traffic for the service.
*/
readonly connections: ec2.Connections;
/**
* A reference to this service.
*/
get serviceRef(): ServiceReference;
/**
* The task definition to use for tasks in the service.
*/
readonly taskDefinition: TaskDefinition;
/**
* The cluster that hosts the service.
*/
readonly cluster: ICluster;
/**
* The details of the AWS Cloud Map service.
*/
protected cloudmapService?: cloudmap.Service;
/**
* A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container
* name (as it appears in a container definition), and the container port to access from the load balancer.
*/
private _loadBalancers;
/**
* A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container
* name (as it appears in a container definition), and the container port to access from the load balancer.
*/
protected networkConfiguration?: CfnService.NetworkConfigurationProperty;
/**
* The deployment alarms property - this will be rendered directly and lazily as the CfnService.alarms
* property.
*/
protected deploymentAlarms?: CfnService.DeploymentAlarmsProperty;
/**
* The details of the service discovery registries to assign to this service.
* For more information, see Service Discovery.
*/
private _serviceRegistries;
/**
* The service connect configuration for this service.
* @internal
*/
protected _serviceConnectConfig?: CfnService.ServiceConnectConfigurationProperty;
/**
* Whether this service is using the ECS deployment controller.
* @internal
*/
private readonly isEcsDeploymentController;
private readonly resource;
private scalableTaskCount?;
/**
* All volumes
*/
private readonly _volumes;
/**
* A deployment lifecycle hook runs custom logic at specific stages of the deployment process.
* @default - none
*/
private readonly _lifecycleHooks;
get serviceArn(): string;
/**
* The details of the service discovery registries to assign to this service.
* For more information, see Service Discovery.
*/
protected set serviceRegistries(sr: CfnService.ServiceRegistryProperty[]);
/**
* The details of the service discovery registries to assign to this service.
* For more information, see Service Discovery.
*/
protected get serviceRegistries(): CfnService.ServiceRegistryProperty[];
/**
* A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container
* name (as it appears in a container definition), and the container port to access from the load balancer.
*/
get loadBalancers(): Array<CfnService.LoadBalancerProperty>;
/**
* A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container
* name (as it appears in a container definition), and the container port to access from the load balancer.
*/
set loadBalancers(value: Array<CfnService.LoadBalancerProperty>);
get serviceName(): string;
/**
* The deployment strategy for the service
*/
private readonly deploymentStrategy?;
/**
* Constructs a new instance of the BaseService class.
*/
constructor(scope: Construct, id: string, props: BaseServiceProps, additionalProps: any, taskDefinition: TaskDefinition);
/**
* Forces a new deployment of the service.
*
* This can be used to trigger a deployment without changing the task definition or desired count.
* ECS will start a new deployment even if there are no changes to the service configuration.
*
* **Important:** When called without a nonce, a timestamp is generated automatically, which means
* every `cdk synth` produces a different template and every `cdk deploy` triggers a new deployment
* regardless of whether any code has changed. To avoid this, provide a stable nonce value that only
* changes when you intentionally want to force a redeployment (e.g., an image digest or a version string).
*
* @param nonce - A unique string (1-255 characters) that signals ECS to start a new deployment.
* If not provided, a timestamp-based nonce is generated.
*/
forceNewDeployment(nonce?: string): void;
/**
* Add a deployment lifecycle hook target
* @param target The lifecycle hook target to add
*/
addLifecycleHook(target: IDeploymentLifecycleHookTarget): void;
private renderLifecycleHooks;
/**
* Adds a volume to the Service.
*/
addVolume(volume: ServiceManagedVolume): void;
private renderVolumes;
/**
* Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization.
* If you have already enabled deployment alarms, this function can be used to tell ECS about additional alarms that
* should interrupt a deployment.
*
* New alarms specified in subsequent calls of this function will be appended to the existing list of alarms.
*
* The same Alarm Behavior must be used on all deployment alarms. If you specify different AlarmBehavior values in
* multiple calls to this function, or the Alarm Behavior used here doesn't match the one used in the service
* constructor, an error will be thrown.
*
* If the alarm's metric references the service, you cannot pass `Alarm.alarmName` here. That will cause a circular
* dependency between the service and its deployment alarm. See this package's README for options to alarm on service
* metrics, and avoid this circular dependency.
*
*/
enableDeploymentAlarms(alarmNames: string[], options?: DeploymentAlarmOptions): void;
/**
* Enable Service Connect on this service.
*/
enableServiceConnect(config?: ServiceConnectProps): void;
/**
* Validate Service Connect Configuration
*/
private validateServiceConnectConfiguration;
/**
* Validate Canary Configuration
*/
private validateCanaryConfiguration;
/**
* Validate Linear Configuration
*/
private validateLinearConfiguration;
/**
* Determines if a port is valid
*
* @param port: The port number
* @returns boolean whether the port is valid
*/
private isValidPort;
/**
* The CloudMap service created for this service, if any.
*/
get cloudMapService(): cloudmap.IService | undefined;
private getDeploymentController;
private executeCommandLogConfiguration;
private enableExecuteCommandEncryption;
/**
* This method is called to attach this service to an Application Load Balancer.
*
* Don't call this function directly. Instead, call `listener.addTargets()`
* to add this service to a load balancer.
*/
attachToApplicationTargetGroup(targetGroup: elbv2.IApplicationTargetGroup): elbv2.LoadBalancerTargetProps;
/**
* Registers the service as a target of a Classic Load Balancer (CLB).
*
* Don't call this. Call `loadBalancer.addTarget()` instead.
*
* @param loadBalancer [disable-awslint:ref-via-interface]
*/
attachToClassicLB(loadBalancer: elb.LoadBalancer): void;
/**
* Return a load balancing target for a specific container and port.
*
* Use this function to create a load balancer target if you want to load balance to
* another container than the first essential container or the first mapped port on
* the container.
*
* Use the return value of this function where you would normally use a load balancer
* target, instead of the `Service` object itself.
*
* @example
*
* declare const listener: elbv2.ApplicationListener;
* declare const service: ecs.BaseService;
* listener.addTargets('ECS', {
* port: 80,
* targets: [service.loadBalancerTarget({
* containerName: 'MyContainer',
* containerPort: 1234,
* })],
* });
*/
loadBalancerTarget(options: LoadBalancerTargetOptions): IEcsLoadBalancerTarget;
/**
* Use this function to create all load balancer targets to be registered in this service, add them to
* target groups, and attach target groups to listeners accordingly.
*
* Alternatively, you can use `listener.addTargets()` to create targets and add them to target groups.
*
* @example
*
* declare const listener: elbv2.ApplicationListener;
* declare const service: ecs.BaseService;
* service.registerLoadBalancerTargets(
* {
* containerName: 'web',
* containerPort: 80,
* newTargetGroupId: 'ECS',
* listener: ecs.ListenerConfig.applicationListener(listener, {
* protocol: elbv2.ApplicationProtocol.HTTPS
* }),
* },
* )
*/
registerLoadBalancerTargets(...targets: EcsTarget[]): void;
/**
* This method is called to attach this service to a Network Load Balancer.
*
* Don't call this function directly. Instead, call `listener.addTargets()`
* to add this service to a load balancer.
*/
attachToNetworkTargetGroup(targetGroup: elbv2.INetworkTargetGroup): elbv2.LoadBalancerTargetProps;
/**
* An attribute representing the minimum and maximum task count for an AutoScalingGroup.
*/
autoScaleTaskCount(props: appscaling.EnableScalingProps): ScalableTaskCount;
/**
* Enable CloudMap service discovery for the service
*
* @returns The created CloudMap service
*/
enableCloudMap(options: CloudMapOptions): cloudmap.Service;
/**
* Associates this service with a CloudMap service
*/
associateCloudMapService(options: AssociateCloudMapServiceOptions): void;
/**
* This method returns the specified CloudWatch metric name for this service.
*/
metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
/**
* This method returns the CloudWatch metric for this service's memory utilization.
*
* @default average over 5 minutes
*/
metricMemoryUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
/**
* This method returns the CloudWatch metric for this service's CPU utilization.
*
* @default average over 5 minutes
*/
metricCpuUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
/**
* This method is called to create a networkConfiguration.
*/
protected configureAwsVpcNetworkingWithSecurityGroups(vpc: ec2.IVpc, assignPublicIp?: boolean, vpcSubnets?: ec2.SubnetSelection, securityGroups?: ec2.ISecurityGroup[]): void;
private renderServiceRegistry;
/**
* Shared logic for attaching to an ELB
*/
private attachToELB;
/**
* Shared logic for attaching to an ELBv2
*/
private attachToELBv2;
private get defaultLoadBalancerTarget();
/**
* Generate the role that will be used for autoscaling this service
*/
private makeAutoScalingRole;
/**
* Associate Service Discovery (Cloud Map) service
*/
private addServiceRegistry;
/**
* Return the default grace period when load balancers are configured and
* healthCheckGracePeriod is not already set
*/
private evaluateHealthGracePeriod;
private enableExecuteCommand;
private deploymentAlarmsAvailableInRegion;
private renderTimeout;
/**
* Checks if the service is using the ECS deployment controller.
* @returns true if the service is using the ECS deployment controller or if no deployment controller is specified (defaults to ECS)
*/
isUsingECSDeploymentController(): boolean;
}
/**
* The options to enabling AWS Cloud Map for an Amazon ECS service.
*/
export interface CloudMapOptions {
/**
* The name of the Cloud Map service to attach to the ECS service.
*
* @default CloudFormation-generated name
*/
readonly name?: string;
/**
* The service discovery namespace for the Cloud Map service to attach to the ECS service.
*
* @default - the defaultCloudMapNamespace associated to the cluster
*/
readonly cloudMapNamespace?: cloudmap.INamespace;
/**
* The DNS record type that you want AWS Cloud Map to create. The supported record types are A or SRV.
*
* @default - DnsRecordType.A if TaskDefinition.networkMode = AWS_VPC, otherwise DnsRecordType.SRV
*/
readonly dnsRecordType?: cloudmap.DnsRecordType.A | cloudmap.DnsRecordType.SRV;
/**
* The amount of time that you want DNS resolvers to cache the settings for this record.
*
* @default Duration.minutes(1)
*/
readonly dnsTtl?: Duration;
/**
* The number of 30-second intervals that you want Cloud Map to wait after receiving an UpdateInstanceCustomHealthStatus
* request before it changes the health status of a service instance.
*
* NOTE: This is used for HealthCheckCustomConfig
*/
readonly failureThreshold?: number;
/**
* The container to point to for a SRV record.
* @default - the task definition's default container
*/
readonly container?: ContainerDefinition;
/**
* The port to point to for a SRV record.
* @default - the default port of the task definition's default container
*/
readonly containerPort?: number;
}
/**
* The options for using a cloudmap service.
*/
export interface AssociateCloudMapServiceOptions {
/**
* The cloudmap service to register with.
*/
readonly service: cloudmap.IService;
/**
* The container to point to for a SRV record.
* @default - the task definition's default container
*/
readonly container?: ContainerDefinition;
/**
* The port to point to for a SRV record.
* @default - the default port of the task definition's default container
*/
readonly containerPort?: number;
}
/**
* The launch type of an ECS service
*/
export declare enum LaunchType {
/**
* The service will be launched using the EC2 launch type
*/
EC2 = "EC2",
/**
* The service will be launched using the FARGATE launch type
*/
FARGATE = "FARGATE",
/**
* The service will be launched using the EXTERNAL launch type
*/
EXTERNAL = "EXTERNAL"
}
/**
* The deployment controller type to use for the service.
*/
export declare enum DeploymentControllerType {
/**
* The rolling update (ECS) deployment type involves replacing the current
* running version of the container with the latest version.
*/
ECS = "ECS",
/**
* The blue/green (CODE_DEPLOY) deployment type uses the blue/green deployment model powered by AWS CodeDeploy
*/
CODE_DEPLOY = "CODE_DEPLOY",
/**
* The external (EXTERNAL) deployment type enables you to use any third-party deployment controller
*/
EXTERNAL = "EXTERNAL"
}
/**
* The deployment stratergy to use for ECS controller
*/
export declare enum DeploymentStrategy {
/**
* Rolling update deployment
*/
ROLLING = "ROLLING",
/**
* Blue/green deployment
*/
BLUE_GREEN = "BLUE_GREEN",
/**
* Linear deployment with progressive traffic shifting
*/
LINEAR = "LINEAR",
/**
* Canary deployment with fixed traffic percentage testing
*/
CANARY = "CANARY"
}
/**
* Propagate tags from either service or task definition
*/
export declare enum PropagatedTagSource {
/**
* Propagate tags from service
*/
SERVICE = "SERVICE",
/**
* Propagate tags from task definition
*/
TASK_DEFINITION = "TASK_DEFINITION",
/**
* Do not propagate
*/
NONE = "NONE"
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
import type { Construct } from 'constructs';
import type { IBaseService } from '../base/base-service';
import type { ICluster } from '../cluster';
/**
* The properties to import from the service.
*/
export interface ServiceAttributes {
/**
* The cluster that hosts the service.
*/
readonly cluster: ICluster;
/**
* The service ARN.
*
* @default - either this, or `serviceName`, is required
*/
readonly serviceArn?: string;
/**
* The name of the service.
*
* @default - either this, or `serviceArn`, is required
*/
readonly serviceName?: string;
}
export declare function fromServiceAttributes(scope: Construct, id: string, attrs: ServiceAttributes): IBaseService;
export declare function extractServiceNameFromArn(scope: Construct, arn: string): string;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.fromServiceAttributes=fromServiceAttributes,exports.extractServiceNameFromArn=extractServiceNameFromArn;var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},cx_api_1=()=>{var tmp=require("../../../cx-api");return cx_api_1=()=>tmp,tmp};function fromServiceAttributes(scope,id,attrs){if(attrs.serviceArn&&attrs.serviceName||!attrs.serviceArn&&!attrs.serviceName)throw new(core_1()).ValidationError((0,literal_string_1().lit)`OnlySpecifyEitherServiceArn`,"You can only specify either serviceArn or serviceName.",scope);const newArnFormat=core_1().FeatureFlags.of(scope).isEnabled(cx_api_1().ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME),stack=core_1().Stack.of(scope);let name,arn;if(attrs.serviceName){name=attrs.serviceName;const resourceName=newArnFormat?`${attrs.cluster.clusterName}/${attrs.serviceName}`:attrs.serviceName;arn=stack.formatArn({partition:stack.partition,service:"ecs",region:stack.region,account:stack.account,resource:"service",resourceName})}else arn=attrs.serviceArn,name=extractServiceNameFromArn(scope,arn);class Import extends core_1().Resource{serviceArn=arn;serviceName=name;cluster=attrs.cluster;get serviceRef(){return{serviceArn:this.serviceArn}}}return new Import(scope,id,{environmentFromArn:arn})}function extractServiceNameFromArn(scope,arn){const newArnFormat=core_1().FeatureFlags.of(scope).isEnabled(cx_api_1().ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME),stack=core_1().Stack.of(scope);if(core_1().Token.isUnresolved(arn))if(newArnFormat){const components=core_1().Fn.split(":",arn),lastComponents=core_1().Fn.split("/",core_1().Fn.select(5,components));return core_1().Fn.select(2,lastComponents)}else return stack.splitArn(arn,core_1().ArnFormat.SLASH_RESOURCE_NAME).resourceName;else{const resourceName=stack.splitArn(arn,core_1().ArnFormat.SLASH_RESOURCE_NAME).resourceName,resourceNameSplit=resourceName.split("/");return resourceNameSplit.length===1?resourceName:resourceNameSplit[1]}}

View File

@@ -0,0 +1,91 @@
import type { Construct } from 'constructs';
import * as appscaling from '../../../aws-applicationautoscaling';
import type * as cloudwatch from '../../../aws-cloudwatch';
import type * as elbv2 from '../../../aws-elasticloadbalancingv2';
/**
* The properties of a scalable attribute representing task count.
*/
export interface ScalableTaskCountProps extends appscaling.BaseScalableAttributeProps {
}
/**
* The scalable attribute representing task count.
*/
export declare class ScalableTaskCount extends appscaling.BaseScalableAttribute {
/**
* Constructs a new instance of the ScalableTaskCount class.
*/
constructor(scope: Construct, id: string, props: ScalableTaskCountProps);
/**
* Scales in or out based on a specified scheduled time.
*/
scaleOnSchedule(id: string, props: appscaling.ScalingSchedule): void;
/**
* Scales in or out based on a specified metric value.
*/
scaleOnMetric(id: string, props: appscaling.BasicStepScalingPolicyProps): void;
/**
* Scales in or out to achieve a target CPU utilization.
*/
scaleOnCpuUtilization(id: string, props: CpuUtilizationScalingProps): void;
/**
* Scales in or out to achieve a target memory utilization.
*/
scaleOnMemoryUtilization(id: string, props: MemoryUtilizationScalingProps): void;
/**
* Scales in or out to achieve a target Application Load Balancer request count per target.
*/
scaleOnRequestCount(id: string, props: RequestCountScalingProps): void;
/**
* Scales in or out to achieve a target on a custom metric.
*/
scaleToTrackCustomMetric(id: string, props: TrackCustomMetricProps): void;
}
/**
* The properties for enabling scaling based on CPU utilization.
*/
export interface CpuUtilizationScalingProps extends appscaling.BaseTargetTrackingProps {
/**
* The target value for CPU utilization across all tasks in the service.
*/
readonly targetUtilizationPercent: number;
}
/**
* The properties for enabling scaling based on memory utilization.
*/
export interface MemoryUtilizationScalingProps extends appscaling.BaseTargetTrackingProps {
/**
* The target value for memory utilization across all tasks in the service.
*/
readonly targetUtilizationPercent: number;
}
/**
* The properties for enabling scaling based on Application Load Balancer (ALB) request counts.
*/
export interface RequestCountScalingProps extends appscaling.BaseTargetTrackingProps {
/**
* The number of ALB requests per target.
*/
readonly requestsPerTarget: number;
/**
* The ALB target group name.
*/
readonly targetGroup: elbv2.ApplicationTargetGroup;
}
/**
* The properties for enabling target tracking scaling based on a custom CloudWatch metric.
*/
export interface TrackCustomMetricProps extends appscaling.BaseTargetTrackingProps {
/**
* The custom CloudWatch metric to track.
*
* The metric must represent utilization; that is, you will always get the following behavior:
*
* - metric > targetValue => scale out
* - metric < targetValue => scale in
*/
readonly metric: cloudwatch.IMetric;
/**
* The target value for the custom CloudWatch metric.
*/
readonly targetValue: number;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScalableTaskCount=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var appscaling=()=>{var tmp=require("../../../aws-applicationautoscaling");return appscaling=()=>tmp,tmp};class ScalableTaskCount extends appscaling().BaseScalableAttribute{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs.ScalableTaskCount",version:"2.252.0"};constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_ScalableTaskCountProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ScalableTaskCount),error}}scaleOnSchedule(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_ScalingSchedule(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleOnSchedule),error}return super.doScaleOnSchedule(id,props)}scaleOnMetric(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_BasicStepScalingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleOnMetric),error}return super.doScaleOnMetric(id,props)}scaleOnCpuUtilization(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_CpuUtilizationScalingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleOnCpuUtilization),error}return super.doScaleToTrackMetric(id,{predefinedMetric:appscaling().PredefinedMetric.ECS_SERVICE_AVERAGE_CPU_UTILIZATION,policyName:props.policyName,disableScaleIn:props.disableScaleIn,targetValue:props.targetUtilizationPercent,scaleInCooldown:props.scaleInCooldown,scaleOutCooldown:props.scaleOutCooldown})}scaleOnMemoryUtilization(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_MemoryUtilizationScalingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleOnMemoryUtilization),error}return super.doScaleToTrackMetric(id,{predefinedMetric:appscaling().PredefinedMetric.ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION,targetValue:props.targetUtilizationPercent,policyName:props.policyName,disableScaleIn:props.disableScaleIn,scaleInCooldown:props.scaleInCooldown,scaleOutCooldown:props.scaleOutCooldown})}scaleOnRequestCount(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_RequestCountScalingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleOnRequestCount),error}const resourceLabel=props.targetGroup.firstLoadBalancerFullName+"/"+props.targetGroup.targetGroupFullName;return super.doScaleToTrackMetric(id,{predefinedMetric:appscaling().PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET,resourceLabel,targetValue:props.requestsPerTarget,policyName:props.policyName,disableScaleIn:props.disableScaleIn,scaleInCooldown:props.scaleInCooldown,scaleOutCooldown:props.scaleOutCooldown})}scaleToTrackCustomMetric(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_TrackCustomMetricProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.scaleToTrackCustomMetric),error}return super.doScaleToTrackMetric(id,{customMetric:props.metric,targetValue:props.targetValue,policyName:props.policyName,disableScaleIn:props.disableScaleIn,scaleInCooldown:props.scaleInCooldown,scaleOutCooldown:props.scaleOutCooldown})}}exports.ScalableTaskCount=ScalableTaskCount;

View File

@@ -0,0 +1,216 @@
import { Construct } from 'constructs';
import * as ec2 from '../../../aws-ec2';
import * as iam from '../../../aws-iam';
import type * as kms from '../../../aws-kms';
import type { Size } from '../../../core';
import type { BaseMountPoint, ContainerDefinition } from '../container-definition';
/**
* Represents the Volume configuration for an ECS service.
*/
export interface ServiceManagedVolumeProps {
/**
* The name of the volume. This corresponds to the name provided in the ECS TaskDefinition.
*/
readonly name: string;
/**
* Configuration for an Amazon Elastic Block Store (EBS) volume managed by ECS.
*
* @default - undefined
*/
readonly managedEBSVolume?: ServiceManagedEBSVolumeConfiguration;
}
/**
* Represents the configuration for an ECS Service managed EBS volume.
*/
export interface ServiceManagedEBSVolumeConfiguration {
/**
* An IAM role that allows ECS to make calls to EBS APIs on your behalf.
* This role is required to create and manage the Amazon EBS volume.
*
* @default - automatically generated role.
*/
readonly role?: iam.IRole;
/**
* Indicates whether the volume should be encrypted.
*
* @default - Default Amazon EBS encryption.
*/
readonly encrypted?: boolean;
/**
* AWS Key Management Service key to use for Amazon EBS encryption.
*
* @default - When `encryption` is turned on and no `kmsKey` is specified,
* the default AWS managed key for Amazon EBS volumes is used.
*/
readonly kmsKeyId?: kms.IKey;
/**
* The volume type.
*
* @default - ec2.EbsDeviceVolumeType.GP2
*/
readonly volumeType?: ec2.EbsDeviceVolumeType;
/**
* The size of the volume in GiB.
*
* You must specify either `size` or `snapshotId`.
* You can optionally specify a volume size greater than or equal to the snapshot size.
*
* The following are the supported volume size values for each volume type.
* - gp2 and gp3: 1-16,384
* - io1 and io2: 4-16,384
* - st1 and sc1: 125-16,384
* - standard: 1-1,024
*
* @default - The snapshot size is used for the volume size if you specify `snapshotId`,
* otherwise this parameter is required.
*/
readonly size?: Size;
/**
* The snapshot that Amazon ECS uses to create the volume.
*
* You must specify either `size` or `snapshotId`.
*
* @default - No snapshot.
*/
readonly snapShotId?: string;
/**
* The number of I/O operations per second (IOPS).
*
* For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned
* for the volume. For gp2 volumes, this represents the baseline performance of the volume
* and the rate at which the volume accumulates I/O credits for bursting.
*
* The following are the supported values for each volume type.
* - gp3: 3,000 - 16,000 IOPS
* - io1: 100 - 64,000 IOPS
* - io2: 100 - 256,000 IOPS
*
* This parameter is required for io1 and io2 volume types. The default for gp3 volumes is
* 3,000 IOPS. This parameter is not supported for st1, sc1, or standard volume types.
*
* @default - undefined
*/
readonly iops?: number;
/**
* The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s.
*
* This parameter is only supported for the gp3 volume type.
*
* @default - No throughput.
*/
readonly throughput?: number;
/**
* The Linux filesystem type for the volume.
*
* For volumes created from a snapshot, you must specify the same filesystem type that
* the volume was using when the snapshot was created.
* The available filesystem types are ext3, ext4, and xfs.
*
* @default - FileSystemType.XFS
*/
readonly fileSystemType?: FileSystemType;
/**
* Specifies the tags to apply to the volume and whether to propagate those tags to the volume.
*
* @default - No tags are specified.
*/
readonly tagSpecifications?: EBSTagSpecification[];
/**
* Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate),
* at which to download the snapshot blocks from Amazon S3 to the volume.
*
* Valid range is between 100 and 300 MiB/s.
*
* @default undefined - The volume initialization rate is not set.
*/
readonly volumeInitializationRate?: Size;
}
/**
* Tag Specification for EBS volume.
*/
export interface EBSTagSpecification {
/**
* The tags to apply to the volume.
*
* @default - No tags
*/
readonly tags?: {
[key: string]: string;
};
/**
* Specifies whether to propagate the tags from the task definition or the service to the task.
* Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION
*
* @default - undefined
*/
readonly propagateTags?: EbsPropagatedTagSource;
}
/**
* FileSystemType for Service Managed EBS Volume Configuration.
*/
export declare enum FileSystemType {
/**
* ext3 type
*/
EXT3 = "ext3",
/**
* ext4 type
*/
EXT4 = "ext4",
/**
* xfs type
*/
XFS = "xfs",
/**
* ntfs type
*/
NTFS = "ntfs"
}
/**
* Propagate tags for EBS Volume Configuration from either service or task definition.
*/
export declare enum EbsPropagatedTagSource {
/**
* SERVICE
*/
SERVICE = "SERVICE",
/**
* TASK_DEFINITION
*/
TASK_DEFINITION = "TASK_DEFINITION"
}
/**
* Defines the mount point details for attaching a volume to a container.
*/
export interface ContainerMountPoint extends BaseMountPoint {
}
/**
* Represents a service-managed volume and always configured at launch.
*/
export declare class ServiceManagedVolume extends Construct {
/**
* Name of the volume, referenced by task definition and mount point.
*/
readonly name: string;
/**
* Volume configuration
*/
readonly config?: ServiceManagedEBSVolumeConfiguration;
/**
* configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume.
*/
readonly configuredAtLaunch: boolean;
/**
* An IAM role that allows ECS to make calls to EBS APIs.
* If not provided, a new role with appropriate permissions will be created by default.
*/
readonly role: iam.IRole;
constructor(scope: Construct, id: string, props: ServiceManagedVolumeProps);
/**
* Mounts the service managed volume to a specified container at a defined mount point.
* @param container The container to mount the volume on.
* @param mountPoint The mounting point details within the container.
*/
mountIn(container: ContainerDefinition, mountPoint: ContainerMountPoint): void;
private validateEbsVolumeConfiguration;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,872 @@
import type { Construct } from 'constructs';
import * as ec2 from '../../../aws-ec2';
import * as iam from '../../../aws-iam';
import type { IResource } from '../../../core';
import { Resource } from '../../../core';
import type { ITaskDefinitionRef, TaskDefinitionReference } from '../../../interfaces/generated/aws-ecs-interfaces.generated';
import type { IAlternateTarget } from '../alternate-target-configuration';
import type { ContainerDefinitionOptions, PortMapping } from '../container-definition';
import { ContainerDefinition, Protocol } from '../container-definition';
import type { FirelensLogRouterDefinitionOptions } from '../firelens-log-router';
import { FirelensLogRouter } from '../firelens-log-router';
import type { PlacementConstraint } from '../placement';
import type { ProxyConfiguration } from '../proxy-configuration/proxy-configuration';
import type { RuntimePlatform } from '../runtime-platform';
/**
* The interface for all task definitions.
*/
export interface ITaskDefinition extends IResource, ITaskDefinitionRef {
/**
* ARN of this task definition
* @attribute
*/
readonly taskDefinitionArn: string;
/**
* Execution role for this task definition
*/
readonly executionRole?: iam.IRole;
/**
* What launch types this task definition should be compatible with.
*/
readonly compatibility: Compatibility;
/**
* Return true if the task definition can be run on an EC2 cluster
*/
readonly isEc2Compatible: boolean;
/**
* Return true if the task definition can be run on a Fargate cluster
*/
readonly isFargateCompatible: boolean;
/**
* Return true if the task definition can be run on a ECS Anywhere cluster
*/
readonly isExternalCompatible: boolean;
/**
* Return true if the task definition can be run on Managed Instances
*/
readonly isManagedInstancesCompatible: boolean;
/**
* The networking mode to use for the containers in the task.
*/
readonly networkMode: NetworkMode;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*/
readonly taskRole: iam.IRole;
}
/**
* The common properties for all task definitions. For more information, see
* [Task Definition Parameters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html).
*/
export interface CommonTaskDefinitionProps {
/**
* The name of a family that this task definition is registered to. A family groups multiple versions of a task definition.
*
* @default - Automatically generated name.
*/
readonly family?: string;
/**
* The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.
*
* The role will be used to retrieve container images from ECR and create CloudWatch log groups.
*
* @default - An execution role will be automatically created if you use ECR images in your task definition.
*/
readonly executionRole?: iam.IRole;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*
* @default - A task role is automatically created for you.
*/
readonly taskRole?: iam.IRole;
/**
* The configuration details for the App Mesh proxy.
*
* @default - No proxy configuration.
*/
readonly proxyConfiguration?: ProxyConfiguration;
/**
* The list of volume definitions for the task. For more information, see
* [Task Definition Parameter Volumes](https://docs.aws.amazon.com/AmazonECS/latest/developerguide//task_definition_parameters.html#volumes).
*
* @default - No volumes are passed to the Docker daemon on a container instance.
*/
readonly volumes?: Volume[];
/**
* Enables fault injection and allows for fault injection requests to be accepted from the task's containers.
*
* Fault injection only works with tasks using the {@link NetworkMode.AWS_VPC} or {@link NetworkMode.HOST} network modes.
*
* @default undefined - ECS default setting is false
*/
readonly enableFaultInjection?: boolean;
}
/**
* The properties for task definitions.
*/
export interface TaskDefinitionProps extends CommonTaskDefinitionProps {
/**
* The networking mode to use for the containers in the task.
*
* On Fargate, the only supported networking mode is AwsVpc.
*
* @default - NetworkMode.Bridge for EC2 & External tasks, AwsVpc for Fargate tasks.
*/
readonly networkMode?: NetworkMode;
/**
* The placement constraints to use for tasks in the service.
*
* You can specify a maximum of 10 constraints per task (this limit includes
* constraints in the task definition and those specified at run time).
*
* Not supported in Fargate.
*
* @default - No placement constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The task launch type compatibility requirement.
*/
readonly compatibility: Compatibility;
/**
* The number of cpu units used by the task.
*
* If you are using the EC2 launch type, this field is optional and any value can be used.
* If you are using the Fargate launch type, this field is required and you must use one of the following values,
* which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
*
* 512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
*
* 1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
*
* 2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
*
* 4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
*
* 8192 (8 vCPU) - Available memory values: Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB)
*
* 16384 (16 vCPU) - Available memory values: Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB)
*
* @default - CPU units are not specified.
*/
readonly cpu?: string;
/**
* The amount (in MiB) of memory used by the task.
*
* If using the EC2 launch type, this field is optional and any value can be used.
* If using the Fargate launch type, this field is required and you must use one of the following values,
* which determines your range of valid values for the cpu parameter:
*
* 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
*
* 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
*
* 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
*
* Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
*
* Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
*
* Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU)
*
* Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU)
*
* @default - Memory used by task is not specified.
*/
readonly memoryMiB?: string;
/**
* The IPC resource namespace to use for the containers in the task.
*
* Not supported in Fargate and Windows containers.
*
* @default - IpcMode used by the task is not specified
*/
readonly ipcMode?: IpcMode;
/**
* The process namespace to use for the containers in the task.
*
* Only supported for tasks that are hosted on AWS Fargate if the tasks
* are using platform version 1.4.0 or later (Linux). Only the TASK option
* is supported for Linux-based Fargate containers. Not supported in Windows
* containers. If pidMode is specified for a Fargate task, then
* runtimePlatform.operatingSystemFamily must also be specified. For more
* information, see [Task Definition Parameters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_definition_pidmode).
*
* @default - PidMode used by the task is not specified
*/
readonly pidMode?: PidMode;
/**
* The inference accelerators to use for the containers in the task.
*
* Not supported in Fargate.
*
* @default - No inference accelerators.
* @deprecated ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
*/
readonly inferenceAccelerators?: InferenceAccelerator[];
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task.
*
* Only supported in Fargate platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
/**
* The operating system that your task definitions are running on.
*
* A runtimePlatform is supported only for tasks using the Fargate launch type.
*
* @default - Undefined.
*/
readonly runtimePlatform?: RuntimePlatform;
}
/**
* The common task definition attributes used across all types of task definitions.
*/
export interface CommonTaskDefinitionAttributes {
/**
* The arn of the task definition
*/
readonly taskDefinitionArn: string;
/**
* The networking mode to use for the containers in the task.
*
* @default Network mode cannot be provided to the imported task.
*/
readonly networkMode?: NetworkMode;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*
* @default Permissions cannot be granted to the imported task.
*/
readonly taskRole?: iam.IRole;
/**
* The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.
*
* Some tasks do not have an execution role.
*
* @default - undefined
*/
readonly executionRole?: iam.IRole;
}
/**
* A reference to an existing task definition
*/
export interface TaskDefinitionAttributes extends CommonTaskDefinitionAttributes {
/**
* What launch types this task definition should be compatible with.
*
* @default Compatibility.EC2_AND_FARGATE
*/
readonly compatibility?: Compatibility;
}
declare abstract class TaskDefinitionBase extends Resource implements ITaskDefinition {
abstract readonly compatibility: Compatibility;
abstract readonly networkMode: NetworkMode;
abstract readonly taskDefinitionArn: string;
abstract readonly taskRole: iam.IRole;
abstract readonly executionRole?: iam.IRole;
/**
* A reference to this task definition.
*/
get taskDefinitionRef(): TaskDefinitionReference;
/**
* Return true if the task definition can be run on an EC2 cluster
*/
get isEc2Compatible(): boolean;
/**
* Return true if the task definition can be run on a Fargate cluster
*/
get isFargateCompatible(): boolean;
/**
* Return true if the task definition can be run on a ECS anywhere cluster
*/
get isExternalCompatible(): boolean;
/**
* Return true if the task definition can be run on Managed Instances
*/
get isManagedInstancesCompatible(): boolean;
}
/**
* The base class for all task definitions.
*/
export declare class TaskDefinition extends TaskDefinitionBase {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Imports a task definition from the specified task definition ARN.
*
* The task will have a compatibility of EC2+Fargate.
*/
static fromTaskDefinitionArn(scope: Construct, id: string, taskDefinitionArn: string): ITaskDefinition;
/**
* Create a task definition from a task definition reference
*/
static fromTaskDefinitionAttributes(scope: Construct, id: string, attrs: TaskDefinitionAttributes): ITaskDefinition;
/**
* The name of a family that this task definition is registered to.
* A family groups multiple versions of a task definition.
*/
readonly family: string;
/**
* The full Amazon Resource Name (ARN) of the task definition.
* @attribute
*/
readonly taskDefinitionArn: string;
/**
* The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*/
readonly taskRole: iam.IRole;
/**
* The networking mode to use for the containers in the task.
*/
readonly networkMode: NetworkMode;
/**
* Default container for this task
*
* Load balancers will send traffic to this container. The first
* essential container that is added to this task will become the default
* container.
*/
defaultContainer?: ContainerDefinition;
/**
* The task launch type compatibility requirement.
*/
readonly compatibility: Compatibility;
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task.
*
* Only supported in Fargate platform version 1.4.0 or later.
*/
readonly ephemeralStorageGiB?: number;
/**
* The process namespace to use for the containers in the task.
*
* Only supported for tasks that are hosted on AWS Fargate if the tasks
* are using platform version 1.4.0 or later (Linux). Not supported in
* Windows containers. If pidMode is specified for a Fargate task,
* then runtimePlatform.operatingSystemFamily must also be specified. For more
* information, see [Task Definition Parameters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_definition_pidmode).
*/
readonly pidMode?: PidMode;
/**
* The container definitions.
*/
protected readonly containers: ContainerDefinition[];
/**
* All volumes
*/
private readonly volumes;
/**
* Placement constraints for task instances
*/
private readonly placementConstraints;
/**
* Inference accelerators for task instances
*/
private readonly _inferenceAccelerators;
private _executionRole?;
private _passRoleStatement?;
private runtimePlatform?;
private readonly _cpu?;
private readonly _memory?;
/**
* Constructs a new instance of the TaskDefinition class.
*/
constructor(scope: Construct, id: string, props: TaskDefinitionProps);
get executionRole(): iam.IRole | undefined;
/**
* Public getter method to access list of inference accelerators attached to the instance.
*/
get inferenceAccelerators(): InferenceAccelerator[];
private renderVolumes;
private renderInferenceAccelerators;
/**
* Validate the existence of the input target and set default values.
*
* @internal
*/
_validateTarget(options: LoadBalancerTargetOptions): LoadBalancerTarget;
/**
* Returns the port range to be opened that match the provided container name and container port.
*
* @internal
*/
_portRangeFromPortMapping(portMapping: PortMapping): ec2.Port;
/**
* Adds a policy statement to the task IAM role.
*/
addToTaskRolePolicy(statement: iam.PolicyStatement): void;
/**
* Adds a policy statement to the task execution IAM role.
*/
addToExecutionRolePolicy(statement: iam.PolicyStatement): void;
/**
* Adds a new container to the task definition.
*/
addContainer(id: string, props: ContainerDefinitionOptions): ContainerDefinition;
/**
* Adds a firelens log router to the task definition.
*/
addFirelensLogRouter(id: string, props: FirelensLogRouterDefinitionOptions): FirelensLogRouter;
/**
* Links a container to this task definition.
* @internal
*/
_linkContainer(container: ContainerDefinition): void;
/**
* Adds a volume to the task definition.
*/
addVolume(volume: Volume): void;
private validateVolume;
/**
* Adds the specified placement constraint to the task definition.
*/
addPlacementConstraint(constraint: PlacementConstraint): void;
/**
* Adds the specified extension to the task definition.
*
* Extension can be used to apply a packaged modification to
* a task definition.
*/
addExtension(extension: ITaskDefinitionExtension): void;
/**
* Adds an inference accelerator to the task definition.
* @deprecated ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
*/
addInferenceAccelerator(inferenceAccelerator: InferenceAccelerator): void;
/**
* Grants permissions to run this task definition
*
* This will grant the following permissions:
*
* - ecs:RunTask
* - iam:PassRole
*
* [disable-awslint:no-grants]
*
* @param grantee Principal to grant consume rights to
*/
grantRun(grantee: iam.IGrantable): iam.Grant;
/**
* Creates the task execution IAM role if it doesn't already exist.
*/
obtainExecutionRole(): iam.IRole;
/**
* Whether this task definition has at least a container that references a
* specific JSON field of a secret stored in Secrets Manager.
*/
get referencesSecretJsonField(): boolean | undefined;
/**
* Validates the task definition.
*/
private validateTaskDefinition;
/**
* Determine the existing port mapping for the provided name.
* @param name: port mapping name
* @returns PortMapping for the provided name, if it exists.
*/
findPortMappingByName(name: string): PortMapping | undefined;
/**
* Returns the container that match the provided containerName.
*/
findContainer(containerName: string): ContainerDefinition | undefined;
private get passRoleStatement();
private renderNetworkMode;
private renderContainers;
private checkFargateWindowsBasedTasksSize;
}
/**
* The networking mode to use for the containers in the task.
*/
export declare enum NetworkMode {
/**
* The task's containers do not have external connectivity and port mappings can't be specified in the container definition.
*/
NONE = "none",
/**
* The task utilizes Docker's built-in virtual network which runs inside each container instance.
*/
BRIDGE = "bridge",
/**
* The task is allocated an elastic network interface.
*/
AWS_VPC = "awsvpc",
/**
* The task bypasses Docker's built-in virtual network and maps container ports directly to the EC2 instance's network interface directly.
*
* In this mode, you can't run multiple instantiations of the same task on a
* single container instance when port mappings are used.
*/
HOST = "host",
/**
* The task utilizes Docker's built-in virtual network which runs inside each Windows container instance.
*/
NAT = "nat"
}
/**
* The IPC resource namespace to use for the containers in the task.
*/
export declare enum IpcMode {
/**
* If none is specified, then IPC resources within the containers of a task are private and not
* shared with other containers in a task or on the container instance
*/
NONE = "none",
/**
* If host is specified, then all containers within the tasks that specified the host IPC mode on
* the same container instance share the same IPC resources with the host Amazon EC2 instance.
*/
HOST = "host",
/**
* If task is specified, all containers within the specified task share the same IPC resources.
*/
TASK = "task"
}
/**
* The process namespace to use for the containers in the task.
*/
export declare enum PidMode {
/**
* If host is specified, then all containers within the tasks that specified the host PID mode
* on the same container instance share the same process namespace with the host Amazon EC2 instance.
*/
HOST = "host",
/**
* If task is specified, all containers within the specified task share the same process namespace.
*/
TASK = "task"
}
/**
* Elastic Inference Accelerator.
* For more information, see [Elastic Inference Basics](https://docs.aws.amazon.com/elastic-inference/latest/developerguide/basics.html)
*/
export interface InferenceAccelerator {
/**
* The Elastic Inference accelerator device name.
* @default - empty
*/
readonly deviceName?: string;
/**
* The Elastic Inference accelerator type to use. The allowed values are: eia2.medium, eia2.large and eia2.xlarge.
* @default - empty
*/
readonly deviceType?: string;
}
/**
* A data volume used in a task definition.
*
* For tasks that use a Docker volume, specify a DockerVolumeConfiguration.
* For tasks that use a bind mount host volume, specify a host and optional sourcePath.
*
* For more information, see [Using Data Volumes in Tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html).
*/
export interface Volume {
/**
* This property is specified when you are using bind mount host volumes.
*
* Bind mount host volumes are supported when you are using either the EC2 or Fargate launch types.
* The contents of the host parameter determine whether your bind mount host volume persists on the
* host container instance and where it is stored. If the host parameter is empty, then the Docker
* daemon assigns a host path for your data volume. However, the data is not guaranteed to persist
* after the containers associated with it stop running.
*/
readonly host?: Host;
/**
* The name of the volume.
*
* Up to 255 letters (uppercase and lowercase), numbers, and hyphens are allowed.
* This name is referenced in the sourceVolume parameter of container definition mountPoints.
*/
readonly name: string;
/**
* Indicates if the volume should be configured at launch.
*
* @default false
*/
readonly configuredAtLaunch?: boolean;
/**
* This property is specified when you are using Docker volumes.
*
* Docker volumes are only supported when you are using the EC2 launch type.
* Windows containers only support the use of the local driver.
* To use bind mounts, specify a host instead.
*/
readonly dockerVolumeConfiguration?: DockerVolumeConfiguration;
/**
* This property is specified when you are using Amazon EFS.
*
* When specifying Amazon EFS volumes in tasks using the Fargate launch type,
* Fargate creates a supervisor container that is responsible for managing the Amazon EFS volume.
* The supervisor container uses a small amount of the task's memory.
* The supervisor container is visible when querying the task metadata version 4 endpoint,
* but is not visible in CloudWatch Container Insights.
*
* @default No Elastic FileSystem is setup
*/
readonly efsVolumeConfiguration?: EfsVolumeConfiguration;
}
/**
* The details on a container instance bind mount host volume.
*/
export interface Host {
/**
* Specifies the path on the host container instance that is presented to the container.
* If the sourcePath value does not exist on the host container instance, the Docker daemon creates it.
* If the location does exist, the contents of the source path folder are exported.
*
* This property is not supported for tasks that use the Fargate launch type.
*/
readonly sourcePath?: string;
}
/**
* Properties for an ECS target.
*
* @internal
*/
export interface LoadBalancerTarget {
/**
* The name of the container.
*/
readonly containerName: string;
/**
* The port mapping of the target.
*/
readonly portMapping: PortMapping;
}
/**
* Properties for defining an ECS target. The port mapping for it must already have been created through addPortMapping().
*/
export interface LoadBalancerTargetOptions {
/**
* The name of the container.
*/
readonly containerName: string;
/**
* The port number of the container. Only applicable when using application/network load balancers.
*
* @default - Container port of the first added port mapping.
*/
readonly containerPort?: number;
/**
* The protocol used for the port mapping. Only applicable when using application load balancers.
*
* @default Protocol.TCP
*/
readonly protocol?: Protocol;
/**
* Alternate target configuration for blue/green deployments.
*
* @default - No alternate target configuration
*/
readonly alternateTarget?: IAlternateTarget;
}
/**
* The configuration for a Docker volume. Docker volumes are only supported when you are using the EC2 launch type.
*/
export interface DockerVolumeConfiguration {
/**
* Specifies whether the Docker volume should be created if it does not already exist.
* If true is specified, the Docker volume will be created for you.
*
* @default false
*/
readonly autoprovision?: boolean;
/**
* The Docker volume driver to use.
*/
readonly driver: string;
/**
* A map of Docker driver-specific options passed through.
*
* @default No options
*/
readonly driverOpts?: {
[key: string]: string;
};
/**
* Custom metadata to add to your Docker volume.
*
* @default No labels
*/
readonly labels?: {
[key: string]: string;
};
/**
* The scope for the Docker volume that determines its lifecycle.
*/
readonly scope: Scope;
}
/**
* The authorization configuration details for the Amazon EFS file system.
*/
export interface AuthorizationConfig {
/**
* The access point ID to use.
* If an access point is specified, the root directory value will be
* relative to the directory set for the access point.
* If specified, transit encryption must be enabled in the EFSVolumeConfiguration.
*
* @default No id
*/
readonly accessPointId?: string;
/**
* Whether or not to use the Amazon ECS task IAM role defined
* in a task definition when mounting the Amazon EFS file system.
* If enabled, transit encryption must be enabled in the EFSVolumeConfiguration.
*
* Valid values: ENABLED | DISABLED
*
* @default If this parameter is omitted, the default value of DISABLED is used.
*/
readonly iam?: string;
}
/**
* The configuration for an Elastic FileSystem volume.
*/
export interface EfsVolumeConfiguration {
/**
* The Amazon EFS file system ID to use.
*/
readonly fileSystemId: string;
/**
* The directory within the Amazon EFS file system to mount as the root directory inside the host.
* Specifying / will have the same effect as omitting this parameter.
*
* @default The root of the Amazon EFS volume
*/
readonly rootDirectory?: string;
/**
* Whether or not to enable encryption for Amazon EFS data in transit between
* the Amazon ECS host and the Amazon EFS server.
* Transit encryption must be enabled if Amazon EFS IAM authorization is used.
*
* Valid values: ENABLED | DISABLED
*
* @default DISABLED
*/
readonly transitEncryption?: string;
/**
* The port to use when sending encrypted data between
* the Amazon ECS host and the Amazon EFS server. EFS mount helper uses.
*
* @default Port selection strategy that the Amazon EFS mount helper uses.
*/
readonly transitEncryptionPort?: number;
/**
* The authorization configuration details for the Amazon EFS file system.
*
* @default No configuration.
*/
readonly authorizationConfig?: AuthorizationConfig;
}
/**
* The scope for the Docker volume that determines its lifecycle.
* Docker volumes that are scoped to a task are automatically provisioned when the task starts and destroyed when the task stops.
* Docker volumes that are scoped as shared persist after the task stops.
*/
export declare enum Scope {
/**
* Docker volumes that are scoped to a task are automatically provisioned when the task starts and destroyed when the task stops.
*/
TASK = "task",
/**
* Docker volumes that are scoped as shared persist after the task stops.
*/
SHARED = "shared"
}
/**
* The task launch type compatibility requirement.
*/
export declare enum Compatibility {
/**
* The task should specify the EC2 launch type.
*/
EC2 = 0,
/**
* The task should specify the Fargate launch type.
*/
FARGATE = 1,
/**
* The task can specify either the EC2 or Fargate launch types.
*/
EC2_AND_FARGATE = 2,
/**
* The task should specify the External launch type.
*/
EXTERNAL = 3,
/**
* The task should specify the Managed Instances launch type.
*/
MANAGED_INSTANCES = 4,
/**
* The task can specify either the EC2 or Managed Instances launch types.
*/
EC2_AND_MANAGED_INSTANCES = 5,
/**
* The task can specify either the Fargate or Managed Instances launch types.
*/
FARGATE_AND_MANAGED_INSTANCES = 6,
/**
* The task can specify either the Fargate, EC2 or Managed Instances launch types.
*/
FARGATE_AND_EC2_AND_MANAGED_INSTANCES = 7
}
/**
* An extension for Task Definitions
*
* Classes that want to make changes to a TaskDefinition (such as
* adding helper containers) can implement this interface, and can
* then be "added" to a TaskDefinition like so:
*
* taskDefinition.addExtension(new MyExtension("some_parameter"));
*/
export interface ITaskDefinitionExtension {
/**
* Apply the extension to the given TaskDefinition
*
* @param taskDefinition [disable-awslint:ref-via-interface]
*/
extend(taskDefinition: TaskDefinition): void;
}
/**
* Return true if the given task definition can be run on an EC2 cluster
*/
export declare function isEc2Compatible(compatibility: Compatibility): boolean;
/**
* Return true if the given task definition can be run on a Fargate cluster
*/
export declare function isFargateCompatible(compatibility: Compatibility): boolean;
/**
* Return true if the given task definition can be run on a ECS Anywhere cluster
*/
export declare function isExternalCompatible(compatibility: Compatibility): boolean;
/**
* Return true if the given task definition can be run on Managed Instances
*/
export declare function isManagedInstancesCompatible(compatibility: Compatibility): boolean;
/**
* Represents revision of a task definition, either a specific numbered revision or
* the `latest` revision
*/
export declare class TaskDefinitionRevision {
/**
* The most recent revision of a task
*/
static readonly LATEST: TaskDefinitionRevision;
/**
* Specific revision of a task
*/
static of(revision: number): TaskDefinitionRevision;
/**
* The string representation of this revision
*/
readonly revision: string;
private constructor();
}
export {};

File diff suppressed because one or more lines are too long