How would I turn a `awsx.ecs.Cluster` into an EC2 ...
# general
f
How would I turn a
awsx.ecs.Cluster
into an EC2 based ECS cluster?
w
There are some notes on this at: https://github.com/pulumi/pulumi-awsx/tree/master/nodejs/awsx/ecs#clusters. Does that address?
f
I think so!
Followed that exactly and received:
Copy code
error: Plan apply failed: 1 error occurred:
    	* creating urn:pulumi:fib-dev-ecs::fib::awsx:x:ecs:Cluster$awsx:x:autoscaling:AutoScalingGroup$aws:cloudformation/stack:Stack::app-asg: ROLLBACK_COMPLETE: ["The following resource(s) failed to create: [Instances]. . Rollback requested by user." "Property AvailabilityZones cannot be empty."]
I'm not passing in a
vpc
as shown in the code. All the docs say that it should use the default vpc when one is not passed in.
I explicitly pass in
vpc
and still get the same result .
According to https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AutoScalingGroup.html,
AvailabilityZones
is required. The CF template in the AWS console does not include the
AvailabilityZones
property.
This is the outputted template:
Copy code
AWSTemplateFormatVersion: '2010-09-09'
    Outputs:
        Instances:
            Value: !Ref Instances
    Resources:
        Instances:
            Type: AWS::AutoScaling::AutoScalingGroup
            Properties:
                Cooldown: 300
                DesiredCapacity: 2
                HealthCheckGracePeriod: 120
                HealthCheckType: EC2
                LaunchConfigurationName: "app-asg-1ff1dbd"
                MaxSize: 100
                MetricsCollection:
                -   Granularity: 1Minute
                MinSize: 2
                VPCZoneIdentifier: []
                Tags:
                -   Key: Name
                    Value: app-asg
                    PropagateAtLaunch: true
            CreationPolicy:
                ResourceSignal:
                    Count: 2
                    Timeout: PT15M
            UpdatePolicy:
                AutoScalingRollingUpdate:
                    MaxBatchSize: 1
                    MinInstancesInService: 2
                    PauseTime: PT15M
                    SuspendProcesses:
                    -   ScheduledActions
                    WaitOnResourceSignals: true
w
That doesn't look right - opened https://github.com/pulumi/pulumi-awsx/issues/289.
f
Any workarounds for now?
w
Looking into that now. Out of curiosity - how did you construct your
vpc
in place of
const vpc = // ... create custom vpc
in the docs example?
f
awsx.ec2.Vpc.getDefault()
👍 1