Guangning Yu's Blog

AWS Certified Solutions Architect Associate Notes

2019-12-05 17:59:42  |  AWS

Compute

EC2

  • Billing for interrupted Spot Instance
    title
    title
  • When you launch an instance from AMI, it uses either paravirtual (PV) or hardware virtual machine (HVM) virtualization. HVM virtualization uses hardware-assist technology provided by the AWS platform.
  • The information about the instance can be retrieved from:
  • The underlying Hypervisor for EC2:
    • Xen
    • Nitro
  • Standard Reserved Instances cannot be moved between regions. You can choose if a Reserved Instance applies to either a specific AZ or an entire region, but you cannot change the region.
  • About EC2 Auto Scaling
    • Can span multi-AZ
  • About Placement Group
    • Three types of Placement Groups
      • Clustered Placement Group
        • Within a single AZ
        • Used for applications that need low network latency, high network throughput, or both
        • Only certain instances can be launched into a Clustered Placement Group
        • AWS r

Mount S3 bucket on EC2 Linux Instance

2019-09-16 10:51:31  |  AWS
  1. Install dependencies

    1. sudo apt-get update
    2. sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
  2. Install s3fs

    1. git clone https://github.com/s3fs-fuse/s3fs-fuse.git
    2. cd s3fs-fuse
    3. ./autogen.sh
    4. ./configure --prefix=/usr --with-openssl
    5. make
    6. sudo make install
    7. which s3fs
  3. Config credentials

    1. echo "Your_accesskey:Your_secretkey" >> /etc/passwd-s3fs
    2. sudo chmod 640 /etc/passwd-s3fs
  4. Create mounting point

    1. mkdir /mys3bucket
    2. s3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket
  5. Config mount after reboot

    Add the following command in /etc/rc.local:

    1. /usr/local/bin/s3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket

Reference:
How to Mount S3 bucket on EC2 Linux Instance

Expand the EBS root volume of EC2 Linux instance

2019-02-24 15:10:42  |  AWS
  1. Modify the EBS Volume from the console https://console.aws.amazon.com/ec2/
  2. Use the lsblk command to list the block devices attached to the instance

    1. $ lsblk
    2. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    3. xvda 202:0 0 30G 0 disk
    4. `-xvda1 202:1 0 8G 0 part /
    5. loop0 7:0 0 91M 1 loop /snap/core/6405
    6. loop1 7:1 0 87.9M 1 loop /snap/core/5742
    7. loop2 7:2 0 17.9M 1 loop /snap/amazon-ssm-agent/1068
    8. loop3 7:3 0 16.5M 1 loop /snap/amazon-ssm-agent/784
    9. loop4 7:4 0 18M 1 loop /snap/amazon-ssm-agent/930
  3. Use the df -h command to report the existing disk space usage on the file system

    1. $ sudo df -h /dev/xvd*
    2. Filesystem Size Used Avail Use% Mounted on
    3. udev 488M 0 488M 0% /dev
    4. /dev/xvda1 7.7G 7.4G 370M 96% /
  4. Expand the modified partition using growpart

    1. $ sudo growpart /dev/xvda 1
    2. CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=62912479,end=62914