Interacting with your first EC2 instance
To deploy an application on an EC2 instance, we first have to login into it and install the necessary packages/software, which can be easily done through an SSH
client, such as MobaXterm
, Putty
, and so on. In this recipe, we will login into an EC2 instance, which we created in the previous recipe, and install Go
using the Red Hat package manager.
How to do it…
- Set the permissions of the private key file—
my-first-ec2-instance.pem
—to400
, which means the user/owner can read, can't write, and can't execute, whereas the group and others can't read, can't write, and can't execute it, by executing thechmod
command, as follows:
$ chmod 400 my-first-ec2-instance.pem
- Get the public DNS of the EC2 instance and connect to it using a private key file as an
ec2-user
by executing thessh
command, as follows:
$ssh -i my-first-ec2-instance.pem ec2-user@ec2-172-31-34-99.compute-1.amazonaws.com
Once the command has executed successfully, we will be logged in to the EC2...