create AutoScalingGroup fail with block_devices
See original GitHub issueCreate AutoScalingGroup fail with block_devices definition in cdk deploy (python)
Cloudformation fail on error
Cannot specify both EBS volume and no-device for block devices. (Service: AmazonAutoScaling; Status Code: 400; Error Code: ValidationError;
Python code
autoscaling.AutoScalingGroup(self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
machine_image=ec2.AmazonLinuxImage(),
block_devices=[autoscaling.BlockDevice(device_name="/dev/sdb", volume=autoscaling.BlockDeviceVolume.ebs(20))]
)
CloudFormation Output
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"DeleteOnTermination": true,
"VolumeSize": 12,
"VolumeType": "gp2"
},
"NoDevice": false
}
],
The older version cdk hasn’t this issue with same cdk coding, it didn’t output “NoDevice” key.
Environment
aws-cdk@1.21.1
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
EC2 instance launch failures - Amazon EC2 Auto Scaling
This page provides information about your EC2 instances that fail to launch, potential causes, and the steps you can take to resolve the...
Read more >How do I troubleshoot scaling issues with my Amazon EC2 ...
... 0:26For more details see the Knowledge Center article with this video: https://aws.amazon.com/premiumsupport/knowledge-center/ auto...
Read more >AWS launch configuration CLI Block Devices not included
I am attempting to automate the creation process of launch configurations for my auto scaling group in aws. I am able to successfully...
Read more >can't create AutoScaling group from launch template
I created my launch template from an existing EC2 instance. When I try to create an AutoScaling group from the template, I get...
Read more >Review - Chapter 5 AWS Flashcards | Quizlet
Identifying a key pair, security group, and a block device mapping are optional elements for an Auto Scaling launch configuration. 5. You are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found a workaround on https://gitter.im/awslabs/aws-cdk?at=5e1f66b58b5d766da1aea4d4 Leave BlockDevices undefined in ASG construct and add a property override to the launch configuration like this:
You can set other properties for the Ebs e.g. {‘VolumeSize’: 100, ‘Encrypted’: True, ‘DeleteOnTermination’: True, ‘VolumeType’: ‘gp2’} but for my use case I didn’t need to. You can also add multiple devices.
I have the same issue using version 1.21.1 with following code.