O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it…

  1. Set the permissions of the private key file—my-first-ec2-instance.pem—to 400, 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 the chmod command, as follows:
$ chmod 400 my-first-ec2-instance.pem
  1. Get the public DNS of the EC2 instance and connect to it using a private key file as an ec2-user by executing the ssh 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 instance and the output will look like the following:

  1. Switch to the root user from ec2-user by executing the sudo command: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required