Amazon EC2 (SYS265) - Chromosom3/TechNotes GitHub Wiki
Amazon EC2
SSH Keys
SSH Key Creation
When creating a EC2 virtual machine you will be prompted to select a key pair when you go to launch the instance. You can either select an existing key pair, create a new key pair, or continue without a key pair. You will want to use SSH keys as they increase security so the first time you will need to create a new key pair and download the keys. Select create new key pair, input a name, and then download the key pair.
Make sure to store the private key (.pem file) in a secure location and do not delete it. You will need this to access your server.
SSH Key Use
When using the SSH keys on Linux you will need to adjust the permissions of the file. The file must be set to user only permissions. You can do this by running chmod 600 $File
. If you are on windows you can skip this step. The default user for EC2 instances is ec2-user or root. You can connect using the SSH key by running ssh [email protected] -i $KEY_FILE
. You would need to change the IP to your server's IP and the $KEY_FILE to your key file path. The I flag specifies the identity you are using to connect with. If you want to use Putty to SSH you will need to change the key format. Open Puttygen and load the pem file. Make sure RSA is selected then hit save private key. For additional security you should add a key passphrase to make the key only usable when the passphrase is entered.
Once the key is saved you can use it with putty. When using Windows EC2 instances you will still need your key to connect. Select the windows server, actions, security, get Windows password. From here you will need to upload your key file to get the password.
Security Groups and Firewall
By default a security group will be created when you make an instance. Select the instance then go to the security tab. Select the security group that was made by default. By default you will see the SSH rule setup.
Now we will create our own rule for port 9000. You will need to select edit inbound rules and then select add rule. Once you create the new rule you can select save rules to apply the rule.