devops-infra-demo
devops-infra-demo copied to clipboard
Add some swapspace to the instance
Without any swap space, the smallest AWS instance that this will work on sucessfully is a t2.small. With some swap space enabled, it might work on a t2.micro or t2.nano or the equivalent t3 machine equivalents.
To see if this works, add a 1GB swap file to the base AMI using Ansible. Then use Terraform to tweak the instance type by putting it into the extra parameters, applying Terraform, and rotating the servers, for example:
instance_type = "t2.micro"
Alternatively this could be accomplished by tweaking the Cloud Init processes initiated through ansible/cloudinit.yml, or through terraform/cloud-config.yml.
It could be something as simple as a cloud-init line such as:
S=/swap && dd bs=1M if=/dev/zero of=$S count=1024 && mkswap $S && chmod 0600 $S && swapon $S