https://pulumi.com logo
Title
f

flaky-baker-91034

04/08/2020, 7:13 PM
Can someone help me understand what's going wrong with the following stack?
"use strict";

const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");

const projet = "ecs-ec2";

const vpc = new awsx.ec2.Vpc(projet);
const cluster = new awsx.ecs.Cluster(projet, { vpc });

const asg = cluster.createAutoScalingGroup("custom", {
    templateParameters: { minSize: 2 },
    launchConfigurationArgs: { instanceType: "t3.medium" },
});

const nlb = new <http://awsx.lb|awsx.lb>.NetworkLoadBalancer("nlb", { vpc, external: true });
const listener = nlb.createListener("listener", { port: 80 });

const ec2Service = new awsx.ecs.FargateService("ec2-nginx", {
    cluster,
    desiredCount: 2,
    taskDefinitionArgs: {
        containers: {
            nginx: {
                image: "nginx",
                memory: 128,
                portMappings: [listener],
            },
        },
    },
});


exports.endpoint = listener.endpoint.hostname;
Tried it 3 times, Twice in us-east-2. Once in us-east-1. Tried with t2.medium and t3.medium as well. It always fails with following message:
Diagnostics:
  aws:cloudformation:Stack (custom):
    error: 1 error occurred:
        * creating urn:pulumi:prod::aws-ecs-ec2::awsx:x:ecs:Cluster$awsx:x:autoscaling:AutoScalingGroup$aws:cloudformation/stack:Stack::custom: ROLLBACK_COMPLETE: ["The following resource(s) failed to create: [Instances]. . Rollback requested by user." "Received 0 SUCCESS signal(s) out of 2.  Unable to satisfy 100% MinSuccessfulInstancesPercent requirement"]
 
  pulumi:pulumi:Stack (aws-ecs-ec2-prod):
    error: update failed
Most of it is taken from here: https://github.com/pulumi/pulumi-awsx/tree/master/nodejs/awsx/ecs Thanks