Useful AWS Commands

Extend the volume of the

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#migrate-data-larger-volume

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        476M     0  476M   0% /dev
tmpfs           493M     0  493M   0% /dev/shm
tmpfs           493M  416K  493M   1% /run
tmpfs           493M     0  493M   0% /sys/fs/cgroup
/dev/xvda1      8.0G  8.0G  4.0K 100% /
tmpfs            99M  4.0K   99M   1% /run/user/1000


$ sudo fdisk -l
GPT PMBR size mismatch (16777215 != 37748735) will be corrected by w(rite).
Disk /dev/xvda: 18 GiB, 19327352832 bytes, 37748736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 534763C8-FA09-4A6F-9848-957F8DF63F89

Device       Start      End  Sectors Size Type
/dev/xvda1    4096 16777182 16773087   8G Linux filesystem
/dev/xvda128  2048     4095     2048   1M BIOS boot

Partition table entries are not in disk order.


Extend the EBS volume and restart

$ sudo resize2fs /dev/xvda
$ sudo df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        476M     0  476M   0% /dev
tmpfs           493M     0  493M   0% /dev/shm
tmpfs           493M  384K  493M   1% /run
tmpfs           493M     0  493M   0% /sys/fs/cgroup
/dev/xvda1       18G  4.7G   14G  26% /
tmpfs            99M     0   99M   0% /run/user/1000



Bootstrap actions for EC2

sudo yum clean all -y
sudo yum update -y
sudo yum install python37 python3-pip -y
sudo pip3 install virtualenv
sudo yum install mysql57 -y