在打包器中构建AMI,包括使用打包器

时间:2015-09-10 22:46:08

标签: amazon-web-services packer

我想构建一个带有两个块设备的AMI,这些设备在配置期间进行了修改。当我使用打包器创建AMI时,它似乎不会拍摄块设备的新快照。有没有办法强迫这个?

我的模板是 { "builders": [{ "type": "amazon-ebs", "region": "us-east-1", "source_ami": "ami-08842d60", "instance_type": "m4.2xlarge", "security_group_id": "<redacted>", "subnet_id" : "<redacted>", "ssh_username": "ec2-user", "ssh_pty": true, "ami_name": "testing {{timestamp}}", "ami_block_device_mappings": [{ "device_name": "/dev/sdf", "volume_type": "gp2", "volume_size": 100, "delete_on_termination": true, "encrypted": true }, { "device_name": "/dev/sdg", "volume_type": "gp2", "volume_size": 100, "delete_on_termination": true, "encrypted": true }] }] }

1 个答案:

答案 0 :(得分:4)

问题在于我使用的是ami_block_device_mappings而不是launch_block_device_mappings。前者仅添加到AMI而不是启动实例。 launch_block_device_mappings被添加到构建AMI的实例中,并将被快照并添加到已注册的AMI。