Some users have encountered issues while building cluster-api compliant AMI because there is a mismatch between the EBS volume size and the AMI snapshot size used by packer to create the EC2 instance. When the mismatch is encountered the following error is reported:
==> rhel-8.4: Error launching sourceinstance: InvalidBlockDeviceMapping: Volume of size15GB is smaller than snapshot'snap-047f51cac491e2e04', expect size >= 25GB
Solution
When this issue is encountered, specify an appropriate EBS size by using the parameter volume_size either in the file images/ami/<os>-<version>.yaml, as in the example below:
download_images: true
packer:
ami_filter_name: "RHEL-7.9*-x86_64-*"
ami_filter_owners: "309956199498"
distribution: "RHEL"
distribution_version: "7.9"
source_ami: ""
ssh_username: "ec2-user"
root_device_name: "/dev/sda1"
volume_size: "25"
build_name: "rhel-7"
packer_builder_type: "amazon"
python_path: ""
Or by overriding the volume_size parameter using the --overrides flag:
konvoy-image build images/ami/centos-79.yaml --overrides volume_size_override.yaml
Where the content of volume_size_override.yaml is:
---
packer:
volume_size: "25"