Add swap space configuration to EBS instance
parent
587947b3d4
commit
5cf334a029
|
@ -0,0 +1,3 @@
|
|||
container_commands:
|
||||
01setup_swap:
|
||||
command: "bash .ebextensions/setupSwap.sh"
|
|
@ -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
|
Loading…
Reference in New Issue