Adding swapfile and building new AMI

I need to create a new AMI for (right now v1.0.3) of rancher OS in a few AWS regions. The AMI should be identical to the official but with a swapfile pre-allocated.

I can’t seem to find instructions for this process on the documentation site. The closest I’ve been able to come so far is to boot an existing instance of rancher and attach a volume as indicated in this post but then use:

ros install -c cloud-config.yml -d /dev/xvdf

Unfortunately then the host reboots. Is there a toolchain that can be used outside of aws to do this? Is this the wrong approach?

Thanks in advance.

Anyone got any ideas here?

Hi @SvenDowideit would you be able to point me to any ami building tooling that you guys use so I can accomplish this, or suggest an alternative?

Thanks in advance

I use a script based cloud-init to format my disks and then install on initial startup - for example https://github.com/SvenDowideit/bin-dir/blob/master/cloud-configs/airgap/install-bastion.sh

or conversely, you can use https://github.com/rancher/os-packer to generate a custom AMI

1 Like