在加壳器中构建 AMI,包括使用加壳器修改快照

Mat*_*tyB 2 packer amazon-web-services

我想构建一个具有两个块设备的 AMI,这两个块设备在配置期间进行修改。当我使用 packer 创建 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 }] }] }

Mat*_*tyB 7

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