Skip to content

Amazon Web Service Guide

Greg Kostin edited this page Mar 29, 2018 · 40 revisions

Amazon Web Services, March 2018

What is difference between Lightsail and EC2?

  1. Create Instance
  • Instance location: Ohio, Zone A
  • Select a platform: Linux/Unix
  • Select a blueprint: OS Only Ubuntu 16.04 LTS
  • Add launch script:

#!/bin/bash

#using export is important since some of the commands in the script will fire in a subshell
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none

apt-get -fuy --force-yes autoremove
apt-get --force-yes clean
apt-get update
apt-get --force-yes -o Dpkg::Options::="--force-confold" --force-yes -o Dpkg::Options::="--force-confdef" -fuy dist-upgrade

apt-get --assume-yes install git-core

# switch user ubuntu
su ubuntu << 'EOF'
cd ~
git init
git remote add origin https://github.com/gkostin1966/heliotrope.git
git fetch
git checkout -t origin/aws
EOF

# launch on reboot
cp -f /etc/rc.local ~ubuntu/rc.local
cat > /etc/rc.local <<EOF
#!/bin/sh -e
~ubuntu/aws/launch.sh &
exit 0
EOF
reboot

  • Change SSH key pair: Default << Download >>
  • Choose your instance plan: $5 month USD
  • Name your instance: Ubuntu-512MB-Ohio-1 x 1

<< Create >>