Add swap space configuration to EBS instance

add-new-regnum-params
Mike Benowitz 2019-07-09 10:47:39 -04:00
parent 587947b3d4
commit 5cf334a029
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,3 @@
container_commands:
01setup_swap:
command: "bash .ebextensions/setupSwap.sh"

View File

@ -0,0 +1,14 @@
#!/bin/bash
SWAPFILE=/var/swapfile
SWAP_MEGABYTES=2048
if [ -f $SWAPFILE ]; then
echo "Swapfile $SWAPFILE found, already configured"
exit;
fi
dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES
chmod 600 $SWAPFILE
mkswap $SWAPFILE
swapon $SWAPFILE