1

I'm using aws cli's autoscaling to create EC2 instances. Despite only having two device mappings in my launch config, the resulting instances have an additional device. The pertinent map Json:

  "BlockDeviceMappings": [
    {
      "DeviceName": "/dev/sda1",
      "Ebs": {
        "VolumeSize": 32,
        "VolumeType": "gp2",
        "DeleteOnTermination": true
      }
    },
    {
      "DeviceName": "/dev/sdb",
      "Ebs": {
        "VolumeSize": 64,
        "VolumeType": "gp2",
        "DeleteOnTermination": true
      }
    }
  ]

Unexpectedly, the the instances have three:

$ sudo lsblk | grep disk
xvda    202:0    0    32G  0 disk
xvdb    202:16   0    64G  0 disk
xvdc    202:32   0  37.5G  0 disk
AXE Labs
  • 1,549
  • 5
  • 19
  • 24

1 Answers1

1

Upon investigation, the EC2 meta-data showed an extra ephemeral mapping:

$ curl -s http://169.254.169.254/latest/meta-data/block-device-mapping/
ami
ebs1
ephemeral1

By reading up on Instance Block Device Mappings it turns out:

By default, an instance that you launch includes any storage devices specified in the block device mapping of the AMI from which you launched the instance. You can specify changes to the block device mapping for an instance when you launch it, and these updates overwrite or merge with the block device mapping of the AMI.

Viewing what mapping the AMI had and overwriting the extra one with NoDevice parameter in the config fixed the problem for subsequent instances.

AXE Labs
  • 1,549
  • 5
  • 19
  • 24
  • "Fixed the problem" ... you removed it? You should probably hang on to that ephemeral disk. They make excellent temp directories and/or swap space since they are local to the instance (and of course they are free). – Michael - sqlbot Jun 01 '16 at 01:28
  • Some Instance let you use ephemeral storage, those are raw SSD speed, and you are not limit to EBS IOPS. – mootmoot Jun 01 '16 at 14:30