CDK Construct library for higher-level ECS Constructs
This library provides higher-level ECS constructs which follow common architectural patterns. It contains:
- Load Balanced Services
- Queue Worker Services
- Scheduled Tasks (cron jobs)
Load Balanced Services
To define a service that is behind a load balancer, instantiate one of the following:
LoadBalancedEc2Service
const loadBalancedEcsService = new ecsPatterns.LoadBalancedEc2Service(stack, 'Service', {
cluster,
memoryLimitMiB: 1024,
image: ecs.ContainerImage.fromRegistry('test'),
desiredCount: 2,
environment: {
TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value",
TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value"
}
});
LoadBalancedFargateService
const loadBalancedFargateService = new ecsPatterns.LoadBalancedFargateService(stack, 'Service', {
cluster,
memoryMiB: '1GB',
cpu: '512',
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
});
Queue Worker Services
To define a service that creates a queue and reads from that queue, instantiate one of the following:
Ec2QueueWorkerService
const ecsQueueWorkerService = new Ec2QueueWorkerService(stack, 'Service', {
cluster,
memoryLimitMiB: 1024,
image: ecs.ContainerImage.fromRegistry('test'),
command: ["-c", "4", "amazon.com"],
enableLogging: false,
desiredTaskCount: 2,
environment: {
TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value",
TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value"
},
queue,
maxScalingCapacity: 5
});
FargateQueueWorkerService
const fargateQueueWorkerService = new FargateQueueWorkerService(stack, 'Service', {
cluster,
memoryMiB: '512',
image: ecs.ContainerImage.fromRegistry('test'),
command: ["-c", "4", "amazon.com"],
enableLogging: false,
desiredTaskCount: 2,
environment: {
TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value",
TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value"
},
queue,
maxScalingCapacity: 5
});
Scheduled Tasks
To define a task that runs periodically, instantiate an ScheduledEc2Task:
// Instantiate an Amazon EC2 Task to run at a scheduled interval
const ecsScheduledTask = new ScheduledEc2Task(this, 'ScheduledTask', {
cluster,
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
scheduleExpression: 'rate(1 minute)',
environment: [{ name: 'TRIGGER', value: 'CloudWatch Events' }],
memoryLimitMiB: 256
});
Release files for aws-cdk.aws-ecs-patterns 0.33.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws-cdk.aws-ecs-patterns-0.33.0.tar.gz | 88.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_cdk.aws_ecs_patterns-0.33.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 174.9 kB
Release files / aws-cdk.aws-ecs-patterns-0.33.0.tar.gz
| Download URL | aws-cdk.aws-ecs-patterns-0.33.0.tar.gz |
|---|---|
| Size | 88.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4262dca5a3545f2c59d1d141658cd5b7febec597dad49285d8069516d2989f8c
|
|
BLAKE2b-256 checksum How to use checksums |
c11317ada7830b72daa477d72409328413b674657e89d53fafa2fa3be9425c32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5
|
Release files / aws_cdk.aws_ecs_patterns-0.33.0-py3-none-any.whl
| Download URL | aws_cdk.aws_ecs_patterns-0.33.0-py3-none-any.whl |
|---|---|
| Size | 86.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba01682036acd2079ae7eff7b6b3a1f8879bc2c7dfdc506392500b2695d7e676
|
|
BLAKE2b-256 checksum How to use checksums |
1453d11a12385c281d49e0cf4a3375c1e9f062869d678526b4e8bec382306aea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5
|