Created
October 26, 2019 20:22
-
-
Save aradhell/cb24b08414b36abfcaa0fe166c6e757b to your computer and use it in GitHub Desktop.
add swap memory to elastic beanstalk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands: | |
create_pre_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/pre" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/00_setup_swap.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/bin/bash | |
SWAPFILE=/var/swapfile | |
SWAP_MEGABYTES=4096 | |
if [ -f $SWAPFILE ]; then | |
echo "Swapfile $SWAPFILE found, skipping" | |
exit 0; | |
fi | |
/bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES | |
/bin/chmod 600 $SWAPFILE | |
/sbin/mkswap $SWAPFILE | |
/sbin/swapon $SWAPFILE | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment