EC2

Connect to EC2 using AWS SDK (i.e. from Java code):

1. Go to

https://console.aws.amazon.com/iam/home?#home

create User

Manage Access Keys (if needed, create an access key), download access key (csv), paste it in the Java Code (VMProvisioner).

In VMProvisioner: Update key name (keyfilename, not keyfilename.pem), update region etc.

2. In IAM console, create group, choose EC2FullAccess policy

3. Add user to this group (I struggled for a long time facing an error message "AWS unauthorized operation", before figured that this was the problem)

1. Just Amazon Linux AMI with the user "view"

ami-15487d25

chmod 400 abc.pem (I think the order is like this )

Enable access to a VM without a key:

ssh into the VM:

ssh -i $USER-key.pem ubuntu@149.165.158.211

enable password-based authentication:

sudo nano /etc/ssh/sshd_config

Edit /etc/ssh/sshd_config setting

PasswordAuthentication yes

sudo service ssh restart

add another user:

sudo useradd test

add user to sudoers' list:

sudo adduser test sudo

create directory for this user:

sudo mkdir /home/test sudo chown test:test /home/test