Thursday, April 27, 2017

New Ubuntu EC2 Instance things to remember

if you want to attach an existing EBS volume to the instance, make sure it's in the same Availability Zone (like "us-east-1c")

To SSH at all:
download that private key that they make you create as part of the setup console
ssh -i (thatkey.pem) -l ubuntu
(there's one user created at the start, called ubuntu)
sudo adduser dantasse
sudo vim /etc/group # and add dantasse to sudo group
sudo vim /etc/ssh/sshd_config # and set PasswordAuthentication to yes
sudo /etc/init.d/ssh reload
Now you should be able to SSH.

Attach the EBS volume on the AWS console. For example, attach it as /dev/sdf. Because it's Ubuntu, it will be attached as /dev/xvdf instead. (because reasons :P) You have to mount it still, though. Say you want to mount it at /data:
sudo mkdir /data
sudo mount /dev/xvdf /data