Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ecs examples #139

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();