Skip to content

Instantly share code, notes, and snippets.

@deanlj
Forked from nathanpeck/gist.js
Created April 16, 2019 16:37
Show Gist options
  • Select an option

  • Save deanlj/c16d5cd73c8b9608e96f1aad3eda9f3c to your computer and use it in GitHub Desktop.

Select an option

Save deanlj/c16d5cd73c8b9608e96f1aad3eda9f3c to your computer and use it in GitHub Desktop.

Revisions

  1. @nathanpeck nathanpeck revised this gist Apr 13, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gist.js
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ export class MyEcsConstructStack extends cdk.Stack {
    cluster: cluster, // Required
    cpu: '512', // Default is 256
    desiredCount: 6, // Default is 1
    image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), // Required
    image: ecs.ContainerImage.fromAsset(this, 'MyImage', { directory: './my-app-dir' }),
    memoryMiB: '2048', // Default is 512
    publicLoadBalancer: true // Default is false
    });
  2. @nathanpeck nathanpeck created this gist Apr 13, 2019.
    23 changes: 23 additions & 0 deletions gist.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    export class MyEcsConstructStack extends cdk.Stack {
    constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const vpc = new ec2.VpcNetwork(this, 'MyVpc', {
    maxAZs: 3 // Default is all AZs in region
    });

    const cluster = new ecs.Cluster(this, 'MyCluster', {
    vpc: vpc
    });

    // Create a load-balanced Fargate service and make it public
    new ecs.LoadBalancedFargateService(this, 'MyFargateService', {
    cluster: cluster, // Required
    cpu: '512', // Default is 256
    desiredCount: 6, // Default is 1
    image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), // Required
    memoryMiB: '2048', // Default is 512
    publicLoadBalancer: true // Default is false
    });
    }
    }