Skip to content

Commit

Permalink
fix: update fargate-service-with-auto-scaling (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored and mergify[bot] committed Oct 14, 2019
1 parent c8bf5ff commit 894f052
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion python/ecs/ecs-load-balanced-service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
self, "Ec2Service",
cluster=cluster,
memory_limit_mib=512,
image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
task_image_options={
'image': ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
}
)

core.CfnOutput(
Expand Down
4 changes: 3 additions & 1 deletion python/ecs/fargate-load-balanced-service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
fargate_service = ecs_patterns.NetworkLoadBalancedFargateService(
self, "FargateService",
cluster=cluster,
image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
task_image_options={
'image': ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
}
)

core.CfnOutput(
Expand Down
4 changes: 3 additions & 1 deletion python/ecs/fargate-service-with-autoscaling/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
fargate_service = ecs_patterns.NetworkLoadBalancedFargateService(
self, "sample-app",
cluster=cluster,
image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
task_image_options={
'image': ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
}
)

# Setup AutoScaling policy
Expand Down
4 changes: 3 additions & 1 deletion typescript/ecs/ecs-load-balanced-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class BonjourECS extends cdk.Stack {
const ecsService = new ecs_patterns.NetworkLoadBalancedEc2Service(this, "Ec2Service", {
cluster,
memoryLimitMiB: 512,
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
}
});

// Output the DNS where you can access your service
Expand Down
4 changes: 3 additions & 1 deletion typescript/ecs/fargate-load-balanced-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class BonjourFargate extends cdk.Stack {
// Instantiate Fargate Service with just cluster and image
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, "FargateService", {
cluster,
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
},
});

// Output the DNS where you can access your service
Expand Down
4 changes: 3 additions & 1 deletion typescript/ecs/fargate-service-with-auto-scaling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class AutoScalingFargateService extends cdk.Stack {
// Create Fargate Service
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample")
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample")
},
});

// Setup AutoScaling policy
Expand Down
6 changes: 4 additions & 2 deletions typescript/ecs/fargate-service-with-local-image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ const stack = new cdk.Stack(app, 'FargateServiceWithLocalImage');
const vpc = new ec2.Vpc(stack, 'MyVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });

// Instantiate Fargate Service with a cluster and a local image that gets
// Instantiate Fargate Service with a cluster and a local image that gets
// uploaded to an S3 staging bucket prior to being uploaded to ECR.
// A new repository is created in ECR and the Fargate service is created
// with the image from ECR.
new ecs_patterns.NetworkLoadBalancedFargateService(stack, "FargateService", {
cluster,
image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'local-image'))
taskImageOptions: {
image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'local-image'))
}
});

app.synth();

0 comments on commit 894f052

Please sign in to comment.