@@ -26,9 +26,7 @@ runs a service on it:
26
26
declare const vpc: ec2 .Vpc ;
27
27
28
28
// Create an ECS cluster
29
- const cluster = new ecs .Cluster (this , ' Cluster' , {
30
- vpc ,
31
- });
29
+ const cluster = new ecs .Cluster (this , ' Cluster' , { vpc });
32
30
33
31
// Add capacity to it
34
32
cluster .addCapacity (' DefaultAutoScalingGroupCapacity' , {
@@ -171,6 +169,7 @@ const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
171
169
To use ` LaunchTemplate ` with ` AsgCapacityProvider ` , make sure to specify the ` userData ` in the ` LaunchTemplate ` :
172
170
173
171
``` ts
172
+ declare const vpc: ec2 .Vpc ;
174
173
const launchTemplate = new ec2 .LaunchTemplate (this , ' ASG-LaunchTemplate' , {
175
174
instanceType: new ec2 .InstanceType (' t3.medium' ),
176
175
machineImage: ecs .EcsOptimizedImage .amazonLinux2 (),
@@ -424,7 +423,7 @@ To grant a principal permission to run your `TaskDefinition`, you can use the `T
424
423
425
424
``` ts
426
425
declare const role: iam .IGrantable ;
427
- const taskDef = new ecs .TaskDefinition (stack , ' TaskDef' , {
426
+ const taskDef = new ecs .TaskDefinition (this , ' TaskDef' , {
428
427
cpu: ' 512' ,
429
428
memoryMiB: ' 512' ,
430
429
compatibility: ecs .Compatibility .EC2_AND_FARGATE ,
@@ -501,7 +500,7 @@ taskDefinition.addContainer('container', {
501
500
linuxParameters: new ecs .LinuxParameters (this , ' LinuxParameters' , {
502
501
initProcessEnabled: true ,
503
502
sharedMemorySize: 1024 ,
504
- maxSwap: 5000 ,
503
+ maxSwap: Size . mebibytes ( 5000 ) ,
505
504
swappiness: 90 ,
506
505
}),
507
506
});
@@ -890,7 +889,7 @@ taskDefinition.addContainer('TheContainer', {
890
889
### splunk Log Driver
891
890
892
891
``` ts
893
- declare const secret: secretsmanager .Secret ;
892
+ declare const secret: ecs .Secret ;
894
893
895
894
// Create a Task Definition for the container to start
896
895
const taskDefinition = new ecs .Ec2TaskDefinition (this , ' TaskDef' );
0 commit comments