I tried to create an Amazon Elastic Compute Cloud (Amazon EC2) instance with an AWS CloudFormation stack, but my stack creation failed. Then, I received the "Server.InternalError: Internal error on launch" error message. How can I resolve this error?
Short description
You receive this error if duplicate or invalid device mappings are specified in your AWS CloudFormation template. You can't have two block devices map to the same location (for example, /dev/sdb).
Note: If you're using a Nitro-based instance type (for example, c5, m5, or t3), then you won't receive this error, because /dev/sdb and /dev/xvdb are mapped to two different NVMe devices in the operating system.
Resolution
In the BlockDeviceMappings property of your AWS CloudFormation template, confirm that your block devices aren't mapping to the same location by checking the value of DeviceName for each block device.
In the following JSON and YAML example templates, the block devices specified are /dev/xvdb and /dev/xvdc. The root volume is automatically provisioned for the instance, and the block devices are associated as secondary volumes.
JSON:
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"...OtherProperties..."
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/xvdb",
"Ebs" : { "VolumeSize" : "100" }
},{
"DeviceName" : "/dev/xvdc",
"Ebs" : { "VolumeSize" : "100" }
}
]
}
}
YAML:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
...OtherProperties...
BlockDeviceMappings:
-
DeviceName: /dev/xvdb
Ebs:
VolumeSize: 100
-
DeviceName: /dev/xvdc
Ebs:
VolumeSize: 100
Related information
Block device mapping
EC2 block device mapping examples
Device names on Linux instances