Skip to content

Instantly share code, notes, and snippets.

@aradhell
Created October 26, 2019 20:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aradhell/cb24b08414b36abfcaa0fe166c6e757b to your computer and use it in GitHub Desktop.
Save aradhell/cb24b08414b36abfcaa0fe166c6e757b to your computer and use it in GitHub Desktop.
add swap memory to elastic beanstalk
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