-
Notifications
You must be signed in to change notification settings - Fork 9
Amazon Web Service Guide
Greg Kostin edited this page Mar 29, 2018
·
40 revisions
What is difference between Lightsail and EC2?
- 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 be executed in subshells
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
# remove, clean, update, & apply dist-upgrade to ubuntu
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
# install git-core
apt-get --assume-yes install git-core
# switch user ubuntu and clone heliotrope
su ubuntu << 'EOF'
cd ~
git init
git remote add origin https://github.com/gkostin1966/heliotrope.git
git fetch
git checkout -t origin/aws
EOF
# ubuntu dist-upgrade requires reboot!
# so backup original rc.local script
cp -f /etc/rc.local ~ubuntu/aws/rc.local
# and overwrite the original rc.local script
cat > /etc/rc.local <<EOF
#!/bin/sh -e
~ubuntu/aws/launch.sh &
exit 0
EOF
# to execute launch script after
reboot
- Change SSH key pair: Default << Download >>
- Choose your instance plan: $5 month USD
- Name your instance: Ubuntu-512MB-Ohio-1 x 1
<< Create >>