2
votes

I am trying to launch an autoscaling group with a single m3.medium instance and attached EBS using CloudFormation (CFN). I have succeeded in doing everything but the EBS part. I've tried adding the following block to my CFN template (as a property of the AWS::AutoScaling::LaunchConfiguration block):

"BlockDeviceMappings": [
  {
    "DeviceName": "/dev/sdf",
    "Ebs": { "VolumeSize": 100, "VolumeType": "gp2" }
  }
]

Without this the launch succeeds. When I include it, aws hangs while trying to create the autoscaling group. There are no error messages to help debug this issue. I've tried creating an EBS through aws console and attaching to the launched m3 instance manually, and this works, but I need to do it through CFN to conform to our automated deployment pipeline.

Are there other resources I need to create in the CFN template to make this work?

2
To answer the direct question, you only need this embedded property on the launch config, and no other resources. It might just be syntax (see my ans) or limits. - nik.shornikov

2 Answers

0
votes

If that's a verbatim block, then you add quotes to volume size (doc is very misleading, as all data types are strings). Here's one that's worked fine for me, and I see no differences:

            "BlockDeviceMappings": [
                {
                    "DeviceName": {
                        "Ref": "SecondaryDevice"
                    },
                    "Ebs": {
                        "VolumeType": "gp2",
                        "VolumeSize": "10"
                    }
                }
            ]

In general, if you need to troubleshoot ASGs, add SNS notifs for launch failures to the auto scaling group (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/ASGettingNotifications.html). You may find that you're on your last hundred gigs of EBS limit (not likely) or that your AMI doesn't like the device type or label you're trying to use (somewhat more likely).

0
votes

Update:

After speaking with AWS support, I resolved this issue. It turns out that AWS makes a distinction between an instance-store-backed and ebs-backed ami. You can only add the BlockDeviceMappings property when using an ebs-backed ami, and I was using the other kind. Luckily, there is a way to convert instance-store-backed to ebs-backed, using this procedure: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-instance-store.html#Using_ConvertingS3toEBS