I have included the steps below for what I did to enable cgroups on an Amazon EC2 instance. The instructions are for “saucy” but “saucy” can be replaced with whichever version of Debian/Ubuntu you are running. Hopefully this will work for you as well.
The information comes from:
https://gist.github.com/ubergarm/9695532
http://ubergarm.github.io/
Malcolm Corney
Alter Boot to allow GRUB loader for CGroups - Required for Amazon Web Services EC2 Instance
=============================================================================================
sudo -s
apt-get update
apt-get purge linux-image-*
apt-get install linux-image-generic-lts-saucy linux-headers-generic-lts-saucy
# setup kexec to actually run the kernel you chose w/ the GRUB_CMDLINE options
vi /etc/default/grub
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
vi /etc/init.d/rcS
*** Add
http://ubergarm.github.io/
if grep -qv ' kexeced$' /proc/cmdline ;then
kexec --load /vmlinuz --initrd=/initrd.img --append='root=LABEL=DOROOT cgroup_enable=memory swapaccount=1 kexeced' &&
mount -o ro,remount / &&
kexec -e
fi
echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/docker.conf
apt-get install kexec-tools
dpkg-reconfigure kexec-tools #yes/yes
# install docker (despite the old package name, lxc is optional as of 0.90)
apt-get install docker cgroup-lite lxc
# libcontainer is default, but im still running lxc for now
vi /etc/default/docker
DOCKER_OPTS="-e lxc"
From: DOMjudge-devel [mailto:domjudge-devel-bounces@domjudge.org] On Behalf Of Myungwoo Chun
Sent: Sunday, 10 July 2016 9:29 PM
To: domjudge-devel@domjudge.org
Subject: Kernel Parameter on AWS EC2
Hi,
I want to enable cgroups for Java memory issues and running multiple judgedaemons in AWS EC2 Ubuntu 14.04 Server instance.
However, I can't add "quiet cgroup_enable=memory swapaccount=1" since AWS EC2 doesn't use grub.
Is there any method to add kernel parameters to AWS EC2 instance?
Thanks,
Myungwoo Chun