We’ve recently had to migrate some 20 servers from DigitalOcean to AWS. Here are some important notes, and the script to take care of the installation.
- We’ve tested this on the latest Debian AMI, but it should work on Ubuntu too
- AWS disables
root
login by default and forces the use ofadmin
- You can simply use DHCP. No need to manually configure IP’s
If you want to enable root
login, simply modify the /root/.ssh/authorized_keys
file. It looks like this initially:
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"admin\" rather than the user \"root\".';echo;sleep 10;exit 142"
Simply remove this stuff, and / or replace with your public key.
Installation
- Create a new AWS EC2 VM (I used
t2.large
) with Debian AMI - Login as
admin
and switch to root (sudo su - root
) - Copy the script into a
setup.sh
or whatever and runbash setup.sh
That’s it.
If you simply reboot, you won’t be able to login with root
nor admin
. Instead, use the password shown before reboot, and login as panther
. Then switch to root
with sudo su - root
and enable root login (as explained before) - or not.
Here’s the script:
- t2.*: Script to setup on t2-type
- t3.*: Script to setup on t3-type