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 { PlacementConstraint, PlacementStrategy } from '../../../aws-ecs';
import { Ec2Service, Ec2TaskDefinition } from '../../../aws-ecs';
import type { ApplicationLoadBalancedServiceBaseProps } from '../base/application-load-balanced-service-base';
import { ApplicationLoadBalancedServiceBase } from '../base/application-load-balanced-service-base';
/**
* The properties for the ApplicationLoadBalancedEc2Service service.
*/
export interface ApplicationLoadBalancedEc2ServiceProps extends ApplicationLoadBalancedServiceBaseProps {
/**
* The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both..
*
* [disable-awslint:ref-via-interface]
*
* @default - none
*/
readonly taskDefinition?: Ec2TaskDefinition;
/**
* The number of cpu units used by the task.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*
* @default none
*/
readonly cpu?: number;
/**
* The hard limit (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under contention, Docker attempts to keep the
* container memory within the limit. If the container requires more memory,
* it can consume up to the value specified by the Memory property or all of
* the available memory on the container instance—whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
/**
* The placement constraints to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
*
* @default - No constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The placement strategies to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
*
* @default - No strategies.
*/
readonly placementStrategies?: PlacementStrategy[];
}
/**
* An EC2 service running on an ECS cluster fronted by an application load balancer.
*/
export declare class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedServiceBase {
/**
* The EC2 service in this construct.
*/
readonly service: Ec2Service;
/**
* The EC2 Task Definition in this construct.
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* Constructs a new instance of the ApplicationLoadBalancedEc2Service class.
*/
constructor(scope: Construct, id: string, props?: ApplicationLoadBalancedEc2ServiceProps);
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApplicationLoadBalancedEc2Service=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},cxapi=()=>{var tmp=require("../../../cx-api");return cxapi=()=>tmp,tmp},application_load_balanced_service_base_1=()=>{var tmp=require("../base/application-load-balanced-service-base");return application_load_balanced_service_base_1=()=>tmp,tmp};class ApplicationLoadBalancedEc2Service extends application_load_balanced_service_base_1().ApplicationLoadBalancedServiceBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedEc2Service",version:"2.252.0"};service;taskDefinition;constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_ApplicationLoadBalancedEc2ServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ApplicationLoadBalancedEc2Service),error}if(props.taskDefinition&&props.taskImageOptions)throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyTaskDefinitionTaskImage`,"You must specify either a taskDefinition or taskImageOptions, not both.",this);if(props.taskDefinition)this.taskDefinition=props.taskDefinition;else if(props.taskImageOptions){const taskImageOptions=props.taskImageOptions;this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"TaskDef",{executionRole:taskImageOptions.executionRole,taskRole:taskImageOptions.taskRole,family:taskImageOptions.family});const enableLogging=taskImageOptions.enableLogging??!0,logDriver=taskImageOptions.logDriver??(enableLogging?this.createAWSLogDriver(this.node.id):void 0),containerName=taskImageOptions.containerName??"web";this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,cpu:props.cpu,memoryLimitMiB:props.memoryLimitMiB,memoryReservationMiB:props.memoryReservationMiB,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,logging:logDriver,dockerLabels:taskImageOptions.dockerLabels,command:taskImageOptions.command,entryPoint:taskImageOptions.entryPoint}).addPortMappings({containerPort:taskImageOptions.containerPort||80})}else throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionImage`,"You must specify one of: taskDefinition or image",this);const desiredCount=core_1().FeatureFlags.of(this).isEnabled(cxapi().ECS_REMOVE_DEFAULT_DESIRED_COUNT)?this.internalDesiredCount:this.desiredCount;this.service=new(aws_ecs_1()).Ec2Service(this,"Service",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,assignPublicIp:!1,serviceName:props.serviceName,healthCheckGracePeriod:props.healthCheckGracePeriod,minHealthyPercent:props.minHealthyPercent,maxHealthyPercent:props.maxHealthyPercent,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,cloudMapOptions:props.cloudMapOptions,deploymentController:props.deploymentController,circuitBreaker:props.circuitBreaker,enableExecuteCommand:props.enableExecuteCommand,placementConstraints:props.placementConstraints,placementStrategies:props.placementStrategies,capacityProviderStrategies:props.capacityProviderStrategies}),this.addServiceAsTarget(this.service)}}exports.ApplicationLoadBalancedEc2Service=ApplicationLoadBalancedEc2Service;

View File

@@ -0,0 +1,91 @@
import type { Construct } from 'constructs';
import type { PlacementConstraint, PlacementStrategy } from '../../../aws-ecs';
import { Ec2Service, Ec2TaskDefinition } from '../../../aws-ecs';
import type { ApplicationTargetGroup } from '../../../aws-elasticloadbalancingv2';
import type { ApplicationMultipleTargetGroupsServiceBaseProps } from '../base/application-multiple-target-groups-service-base';
import { ApplicationMultipleTargetGroupsServiceBase } from '../base/application-multiple-target-groups-service-base';
/**
* The properties for the ApplicationMultipleTargetGroupsEc2Service service.
*/
export interface ApplicationMultipleTargetGroupsEc2ServiceProps extends ApplicationMultipleTargetGroupsServiceBaseProps {
/**
* The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified.
*
* [disable-awslint:ref-via-interface]
*
* @default - none
*/
readonly taskDefinition?: Ec2TaskDefinition;
/**
* The minimum number of CPU units to reserve for the container.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* @default - No minimum CPU units reserved.
*/
readonly cpu?: number;
/**
* The amount (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under heavy contention, Docker attempts to keep the
* container memory to this soft limit. However, your container can consume more
* memory when it needs to, up to either the hard limit specified with the memory
* parameter (if applicable), or all of the available memory on the container
* instance, whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* Note that this setting will be ignored if TaskImagesOptions is specified
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
/**
* The placement constraints to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
*
* @default - No constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The placement strategies to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
*
* @default - No strategies.
*/
readonly placementStrategies?: PlacementStrategy[];
}
/**
* An EC2 service running on an ECS cluster fronted by an application load balancer.
*/
export declare class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultipleTargetGroupsServiceBase {
/**
* The EC2 service in this construct.
*/
readonly service: Ec2Service;
/**
* The EC2 Task Definition in this construct.
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* The default target group for the service.
* @deprecated - Use `targetGroups` instead.
*/
readonly targetGroup: ApplicationTargetGroup;
/**
* Constructs a new instance of the ApplicationMultipleTargetGroupsEc2Service class.
*/
constructor(scope: Construct, id: string, props?: ApplicationMultipleTargetGroupsEc2ServiceProps);
private createEc2Service;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApplicationMultipleTargetGroupsEc2Service=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},cxapi=()=>{var tmp=require("../../../cx-api");return cxapi=()=>tmp,tmp},application_multiple_target_groups_service_base_1=()=>{var tmp=require("../base/application-multiple-target-groups-service-base");return application_multiple_target_groups_service_base_1=()=>tmp,tmp};class ApplicationMultipleTargetGroupsEc2Service extends application_multiple_target_groups_service_base_1().ApplicationMultipleTargetGroupsServiceBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.ApplicationMultipleTargetGroupsEc2Service",version:"2.252.0"};service;taskDefinition;targetGroup;constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_ApplicationMultipleTargetGroupsEc2ServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ApplicationMultipleTargetGroupsEc2Service),error}if(props.taskDefinition&&props.taskImageOptions)throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionTask`,"You must specify only one of TaskDefinition or TaskImageOptions.",this);if(props.taskDefinition)this.taskDefinition=props.taskDefinition;else if(props.taskImageOptions){const taskImageOptions=props.taskImageOptions;this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"TaskDef",{executionRole:taskImageOptions.executionRole,taskRole:taskImageOptions.taskRole});const containerName=taskImageOptions.containerName??"web",container=this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,cpu:props.cpu,memoryLimitMiB:props.memoryLimitMiB,memoryReservationMiB:props.memoryReservationMiB,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,logging:this.logDriver,dockerLabels:taskImageOptions.dockerLabels});if(taskImageOptions.containerPorts)for(const containerPort of taskImageOptions.containerPorts)container.addPortMappings({containerPort})}else throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionImage`,"You must specify one of: taskDefinition or image",this);if(!this.taskDefinition.defaultContainer)throw new(core_1()).ValidationError((0,literal_string_1().lit)`LeastOneEssentialContainerSpecified`,"At least one essential container must be specified",this);this.taskDefinition.defaultContainer.portMappings.length===0&&this.taskDefinition.defaultContainer.addPortMappings({containerPort:80}),this.service=this.createEc2Service(props),props.targetGroups?(this.addPortMappingForTargets(this.taskDefinition.defaultContainer,props.targetGroups),this.targetGroup=this.registerECSTargets(this.service,this.taskDefinition.defaultContainer,props.targetGroups)):this.targetGroup=this.listener.addTargets("ECS",{targets:[this.service],port:this.taskDefinition.defaultContainer.portMappings[0].containerPort})}createEc2Service(props){const desiredCount=core_1().FeatureFlags.of(this).isEnabled(cxapi().ECS_REMOVE_DEFAULT_DESIRED_COUNT)?this.internalDesiredCount:this.desiredCount;return new(aws_ecs_1()).Ec2Service(this,"Service",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,assignPublicIp:!1,serviceName:props.serviceName,healthCheckGracePeriod:props.healthCheckGracePeriod,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,cloudMapOptions:props.cloudMapOptions,enableExecuteCommand:props.enableExecuteCommand,placementConstraints:props.placementConstraints,placementStrategies:props.placementStrategies})}}exports.ApplicationMultipleTargetGroupsEc2Service=ApplicationMultipleTargetGroupsEc2Service;

View File

@@ -0,0 +1,93 @@
import type { Construct } from 'constructs';
import type { PlacementConstraint, PlacementStrategy } from '../../../aws-ecs';
import { Ec2Service, Ec2TaskDefinition } from '../../../aws-ecs';
import type { NetworkLoadBalancedServiceBaseProps } from '../base/network-load-balanced-service-base';
import { NetworkLoadBalancedServiceBase } from '../base/network-load-balanced-service-base';
/**
* The properties for the NetworkLoadBalancedEc2Service service.
*/
export interface NetworkLoadBalancedEc2ServiceProps extends NetworkLoadBalancedServiceBaseProps {
/**
* The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both..
*
* [disable-awslint:ref-via-interface]
*
* @default - none
*/
readonly taskDefinition?: Ec2TaskDefinition;
/**
* The number of cpu units used by the task.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*
* @default none
*/
readonly cpu?: number;
/**
* The hard limit (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under contention, Docker attempts to keep the
* container memory within the limit. If the container requires more memory,
* it can consume up to the value specified by the Memory property or all of
* the available memory on the container instance—whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
/**
* The placement constraints to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
*
* @default - No constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The placement strategies to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
*
* @default - No strategies.
*/
readonly placementStrategies?: PlacementStrategy[];
}
/**
* An EC2 service running on an ECS cluster fronted by a network load balancer.
*/
export declare class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBase {
/**
* The ECS service in this construct.
*/
readonly service: Ec2Service;
/**
* The EC2 Task Definition in this construct.
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* Constructs a new instance of the NetworkLoadBalancedEc2Service class.
*/
constructor(scope: Construct, id: string, props?: NetworkLoadBalancedEc2ServiceProps);
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NetworkLoadBalancedEc2Service=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},cxapi=()=>{var tmp=require("../../../cx-api");return cxapi=()=>tmp,tmp},network_load_balanced_service_base_1=()=>{var tmp=require("../base/network-load-balanced-service-base");return network_load_balanced_service_base_1=()=>tmp,tmp};class NetworkLoadBalancedEc2Service extends network_load_balanced_service_base_1().NetworkLoadBalancedServiceBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.NetworkLoadBalancedEc2Service",version:"2.252.0"};service;taskDefinition;constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_NetworkLoadBalancedEc2ServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NetworkLoadBalancedEc2Service),error}if(props.taskDefinition&&props.taskImageOptions)throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyTaskDefinitionImage`,"You must specify either a taskDefinition or an image, not both.",this);if(props.taskDefinition)this.taskDefinition=props.taskDefinition;else if(props.taskImageOptions){const taskImageOptions=props.taskImageOptions;this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"TaskDef",{executionRole:taskImageOptions.executionRole,taskRole:taskImageOptions.taskRole,family:taskImageOptions.family});const enableLogging=taskImageOptions.enableLogging??!0,logDriver=taskImageOptions.logDriver??(enableLogging?this.createAWSLogDriver(this.node.id):void 0),containerName=taskImageOptions.containerName??"web";this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,cpu:props.cpu,memoryLimitMiB:props.memoryLimitMiB,memoryReservationMiB:props.memoryReservationMiB,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,logging:logDriver,dockerLabels:taskImageOptions.dockerLabels}).addPortMappings({containerPort:taskImageOptions.containerPort||80})}else throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionImage`,"You must specify one of: taskDefinition or image",this);const desiredCount=core_1().FeatureFlags.of(this).isEnabled(cxapi().ECS_REMOVE_DEFAULT_DESIRED_COUNT)?this.internalDesiredCount:this.desiredCount;this.service=new(aws_ecs_1()).Ec2Service(this,"Service",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,assignPublicIp:!1,serviceName:props.serviceName,healthCheckGracePeriod:props.healthCheckGracePeriod,minHealthyPercent:props.minHealthyPercent,maxHealthyPercent:props.maxHealthyPercent,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,cloudMapOptions:props.cloudMapOptions,deploymentController:props.deploymentController,circuitBreaker:props.circuitBreaker,enableExecuteCommand:props.enableExecuteCommand,placementConstraints:props.placementConstraints,placementStrategies:props.placementStrategies,capacityProviderStrategies:props.capacityProviderStrategies}),this.addServiceAsTarget(this.service)}}exports.NetworkLoadBalancedEc2Service=NetworkLoadBalancedEc2Service;

View File

@@ -0,0 +1,91 @@
import type { Construct } from 'constructs';
import type { PlacementConstraint, PlacementStrategy } from '../../../aws-ecs';
import { Ec2Service, Ec2TaskDefinition } from '../../../aws-ecs';
import type { NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2';
import type { NetworkMultipleTargetGroupsServiceBaseProps } from '../base/network-multiple-target-groups-service-base';
import { NetworkMultipleTargetGroupsServiceBase } from '../base/network-multiple-target-groups-service-base';
/**
* The properties for the NetworkMultipleTargetGroupsEc2Service service.
*/
export interface NetworkMultipleTargetGroupsEc2ServiceProps extends NetworkMultipleTargetGroupsServiceBaseProps {
/**
* The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified.
*
* [disable-awslint:ref-via-interface]
*
* @default - none
*/
readonly taskDefinition?: Ec2TaskDefinition;
/**
* The minimum number of CPU units to reserve for the container.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* @default - No minimum CPU units reserved.
*/
readonly cpu?: number;
/**
* The amount (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under heavy contention, Docker attempts to keep the
* container memory to this soft limit. However, your container can consume more
* memory when it needs to, up to either the hard limit specified with the memory
* parameter (if applicable), or all of the available memory on the container
* instance, whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required.
*
* Note that this setting will be ignored if TaskImagesOptions is specified.
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
/**
* The placement constraints to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
*
* @default - No constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The placement strategies to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
*
* @default - No strategies.
*/
readonly placementStrategies?: PlacementStrategy[];
}
/**
* An EC2 service running on an ECS cluster fronted by a network load balancer.
*/
export declare class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTargetGroupsServiceBase {
/**
* The EC2 service in this construct.
*/
readonly service: Ec2Service;
/**
* The EC2 Task Definition in this construct.
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* The default target group for the service.
* @deprecated - Use `targetGroups` instead.
*/
readonly targetGroup: NetworkTargetGroup;
/**
* Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class.
*/
constructor(scope: Construct, id: string, props?: NetworkMultipleTargetGroupsEc2ServiceProps);
private createEc2Service;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NetworkMultipleTargetGroupsEc2Service=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},cxapi=()=>{var tmp=require("../../../cx-api");return cxapi=()=>tmp,tmp},network_multiple_target_groups_service_base_1=()=>{var tmp=require("../base/network-multiple-target-groups-service-base");return network_multiple_target_groups_service_base_1=()=>tmp,tmp};class NetworkMultipleTargetGroupsEc2Service extends network_multiple_target_groups_service_base_1().NetworkMultipleTargetGroupsServiceBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.NetworkMultipleTargetGroupsEc2Service",version:"2.252.0"};service;taskDefinition;targetGroup;constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_NetworkMultipleTargetGroupsEc2ServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NetworkMultipleTargetGroupsEc2Service),error}if(props.taskDefinition&&props.taskImageOptions)throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionTask`,"You must specify only one of TaskDefinition or TaskImageOptions.",this);if(props.taskDefinition)this.taskDefinition=props.taskDefinition;else if(props.taskImageOptions){const taskImageOptions=props.taskImageOptions;this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"TaskDef",{executionRole:taskImageOptions.executionRole,taskRole:taskImageOptions.taskRole});const containerName=taskImageOptions.containerName??"web",container=this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,cpu:props.cpu,memoryLimitMiB:props.memoryLimitMiB,memoryReservationMiB:props.memoryReservationMiB,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,logging:this.logDriver,dockerLabels:taskImageOptions.dockerLabels});if(taskImageOptions.containerPorts)for(const containerPort of taskImageOptions.containerPorts)container.addPortMappings({containerPort})}else throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyOneTaskDefinitionImage`,"You must specify one of: taskDefinition or image",this);if(!this.taskDefinition.defaultContainer)throw new(core_1()).ValidationError((0,literal_string_1().lit)`LeastOneEssentialContainerSpecified`,"At least one essential container must be specified",this);if(this.taskDefinition.defaultContainer.portMappings.length===0&&this.taskDefinition.defaultContainer.addPortMappings({containerPort:80}),this.service=this.createEc2Service(props),props.targetGroups)this.addPortMappingForTargets(this.taskDefinition.defaultContainer,props.targetGroups),this.targetGroup=this.registerECSTargets(this.service,this.taskDefinition.defaultContainer,props.targetGroups);else{const containerPort=this.taskDefinition.defaultContainer.portMappings[0].containerPort;if(!containerPort)throw new(core_1()).ValidationError((0,literal_string_1().lit)`FirstPortMappingAddedDefault`,"The first port mapping added to the default container must expose a single port",this);this.targetGroup=this.listener.addTargets("ECS",{targets:[this.service],port:containerPort})}}createEc2Service(props){const desiredCount=core_1().FeatureFlags.of(this).isEnabled(cxapi().ECS_REMOVE_DEFAULT_DESIRED_COUNT)?this.internalDesiredCount:this.desiredCount;return new(aws_ecs_1()).Ec2Service(this,"Service",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,assignPublicIp:!1,serviceName:props.serviceName,healthCheckGracePeriod:props.healthCheckGracePeriod,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,cloudMapOptions:props.cloudMapOptions,enableExecuteCommand:props.enableExecuteCommand,placementConstraints:props.placementConstraints,placementStrategies:props.placementStrategies})}}exports.NetworkMultipleTargetGroupsEc2Service=NetworkMultipleTargetGroupsEc2Service;

View File

@@ -0,0 +1,97 @@
import type { Construct } from 'constructs';
import type { PlacementConstraint, PlacementStrategy } from '../../../aws-ecs';
import { Ec2Service, Ec2TaskDefinition } from '../../../aws-ecs';
import type { QueueProcessingServiceBaseProps } from '../base/queue-processing-service-base';
import { QueueProcessingServiceBase } from '../base/queue-processing-service-base';
/**
* The properties for the QueueProcessingEc2Service service.
*/
export interface QueueProcessingEc2ServiceProps extends QueueProcessingServiceBaseProps {
/**
* The number of cpu units used by the task.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*
* @default none
*/
readonly cpu?: number;
/**
* The hard limit (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under contention, Docker attempts to keep the
* container memory within the limit. If the container requires more memory,
* it can consume up to the value specified by the Memory property or all of
* the available memory on the container instance—whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
/**
* Gpu count for container in task definition. Set this if you want to use gpu based instances.
*
* @default - No GPUs assigned.
*/
readonly gpuCount?: number;
/**
* Optional name for the container added
*
* @default - QueueProcessingContainer
*/
readonly containerName?: string;
/**
* The placement constraints to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
*
* @default - No constraints.
*/
readonly placementConstraints?: PlacementConstraint[];
/**
* The placement strategies to use for tasks in the service. For more information, see
* [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
*
* @default - No strategies.
*/
readonly placementStrategies?: PlacementStrategy[];
}
/**
* Class to create a queue processing EC2 service.
*/
export declare class QueueProcessingEc2Service extends QueueProcessingServiceBase {
/**
* The EC2 service in this construct.
*/
readonly service: Ec2Service;
/**
* The EC2 task definition in this construct
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* Constructs a new instance of the QueueProcessingEc2Service class.
*/
constructor(scope: Construct, id: string, props?: QueueProcessingEc2ServiceProps);
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueueProcessingEc2Service=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},cxapi=()=>{var tmp=require("../../../cx-api");return cxapi=()=>tmp,tmp},queue_processing_service_base_1=()=>{var tmp=require("../base/queue-processing-service-base");return queue_processing_service_base_1=()=>tmp,tmp};class QueueProcessingEc2Service extends queue_processing_service_base_1().QueueProcessingServiceBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.QueueProcessingEc2Service",version:"2.252.0"};service;taskDefinition;constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_QueueProcessingEc2ServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,QueueProcessingEc2Service),error}if(!props.image)throw new(core_1()).ValidationError((0,literal_string_1().lit)`ImageSpecifiedQueueProcessingService`,"image must be specified for EC2 queue processing service",this);const containerName=props.containerName??"QueueProcessingContainer";this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"QueueProcessingTaskDef",{family:props.family}),this.taskDefinition.addContainer(containerName,{image:props.image,memoryLimitMiB:props.memoryLimitMiB,memoryReservationMiB:props.memoryReservationMiB,cpu:props.cpu,gpuCount:props.gpuCount,command:props.command,environment:this.environment,secrets:this.secrets,logging:this.logDriver});const desiredCount=core_1().FeatureFlags.of(this).isEnabled(cxapi().ECS_REMOVE_DEFAULT_DESIRED_COUNT)?void 0:this.desiredCount;this.service=new(aws_ecs_1()).Ec2Service(this,"QueueProcessingService",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,serviceName:props.serviceName,minHealthyPercent:props.minHealthyPercent,maxHealthyPercent:props.maxHealthyPercent,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,deploymentController:props.deploymentController,circuitBreaker:props.circuitBreaker,capacityProviderStrategies:props.capacityProviderStrategies,enableExecuteCommand:props.enableExecuteCommand,placementConstraints:props.placementConstraints,placementStrategies:props.placementStrategies}),this.configureAutoscalingForService(this.service),this.grantPermissionsToService(this.service)}}exports.QueueProcessingEc2Service=QueueProcessingEc2Service;

View File

@@ -0,0 +1,89 @@
import type { Construct } from 'constructs';
import { Ec2TaskDefinition } from '../../../aws-ecs';
import type { EcsTask } from '../../../aws-events-targets';
import type { ScheduledTaskBaseProps, ScheduledTaskImageProps } from '../base/scheduled-task-base';
import { ScheduledTaskBase } from '../base/scheduled-task-base';
/**
* The properties for the ScheduledEc2Task task.
*/
export interface ScheduledEc2TaskProps extends ScheduledTaskBaseProps {
/**
* The properties to define if using an existing TaskDefinition in this construct.
* ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both.
*
* @default none
*/
readonly scheduledEc2TaskDefinitionOptions?: ScheduledEc2TaskDefinitionOptions;
/**
* The properties to define if the construct is to create a TaskDefinition.
* ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both.
*
* @default none
*/
readonly scheduledEc2TaskImageOptions?: ScheduledEc2TaskImageOptions;
}
/**
* The properties for the ScheduledEc2Task using an image.
*/
export interface ScheduledEc2TaskImageOptions extends ScheduledTaskImageProps {
/**
* The minimum number of CPU units to reserve for the container.
*
* @default none
*/
readonly cpu?: number;
/**
* The hard limit (in MiB) of memory to present to the container.
*
* If your container attempts to exceed the allocated memory, the container
* is terminated.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
*
* @default - No memory limit.
*/
readonly memoryLimitMiB?: number;
/**
* The soft limit (in MiB) of memory to reserve for the container.
*
* When system memory is under contention, Docker attempts to keep the
* container memory within the limit. If the container requires more memory,
* it can consume up to the value specified by the Memory property or all of
* the available memory on the container instance—whichever comes first.
*
* At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
*
* @default - No memory reserved.
*/
readonly memoryReservationMiB?: number;
}
/**
* The properties for the ScheduledEc2Task using a task definition.
*/
export interface ScheduledEc2TaskDefinitionOptions {
/**
* The task definition to use for tasks in the service. One of image or taskDefinition must be specified.
*
* [disable-awslint:ref-via-interface]
*
* @default - none
*/
readonly taskDefinition: Ec2TaskDefinition;
}
/**
* A scheduled EC2 task that will be initiated off of CloudWatch Events.
*/
export declare class ScheduledEc2Task extends ScheduledTaskBase {
/**
* The EC2 task definition in this construct.
*/
readonly taskDefinition: Ec2TaskDefinition;
/**
* The ECS task in this construct.
*/
readonly task: EcsTask;
/**
* Constructs a new instance of the ScheduledEc2Task class.
*/
constructor(scope: Construct, id: string, props: ScheduledEc2TaskProps);
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScheduledEc2Task=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_ecs_1=()=>{var tmp=require("../../../aws-ecs");return aws_ecs_1=()=>tmp,tmp},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},scheduled_task_base_1=()=>{var tmp=require("../base/scheduled-task-base");return scheduled_task_base_1=()=>tmp,tmp};class ScheduledEc2Task extends scheduled_task_base_1().ScheduledTaskBase{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs_patterns.ScheduledEc2Task",version:"2.252.0"};taskDefinition;task;constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_patterns_ScheduledEc2TaskProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ScheduledEc2Task),error}if(props.scheduledEc2TaskDefinitionOptions&&props.scheduledEc2TaskImageOptions)throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyScheduledEcTaskDefinition`,"You must specify either a scheduledEc2TaskDefinitionOptions or scheduledEc2TaskOptions, not both.",this);if(props.scheduledEc2TaskDefinitionOptions)this.taskDefinition=props.scheduledEc2TaskDefinitionOptions.taskDefinition;else if(props.scheduledEc2TaskImageOptions){const taskImageOptions=props.scheduledEc2TaskImageOptions,containerName=taskImageOptions.containerName??"ScheduledContainer";this.taskDefinition=new(aws_ecs_1()).Ec2TaskDefinition(this,"ScheduledTaskDef"),this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,memoryLimitMiB:taskImageOptions.memoryLimitMiB,memoryReservationMiB:taskImageOptions.memoryReservationMiB,cpu:taskImageOptions.cpu,command:taskImageOptions.command,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,logging:taskImageOptions.logDriver??this.createAWSLogDriver(this.node.id)})}else throw new(core_1()).ValidationError((0,literal_string_1().lit)`SpecifyTaskDefinitionImage`,"You must specify a taskDefinition or image",this);this.task=this.addTaskDefinitionToEventTarget(this.taskDefinition)}}exports.ScheduledEc2Task=ScheduledEc2Task;