how to login to ec2 machine?

前端 未结 5 1601
借酒劲吻你
借酒劲吻你 2021-01-30 21:03

I was given some login information for an EC2 machine, basically an ec2-X-X-X.compute-X.amazonaws.com plus a username and password.

How do I access the machine? I tried

5条回答
  •  无人及你
    2021-01-30 21:50

    If you are new to AWS and need to access a brand new EC2 instance via ssh, keep in mind that you also need to allow incoming traffic on port 22.

    Assuming that the EC2 instance was created accepting all the default wizard suggestions, access to the machine will be guarded by the default security group, which basically prohibits all inbound traffic. Thus:

    1. Go to the AWS console
    2. Choose Security Groups on the left navigation pane
    3. Choose default from the main pane (it may be the only item in the list)
    4. In the bottom pane, choose Inbound, then Create a new rule: SSH
    5. Click Add rule and then Apply Rule Changes

    Next, assuming that you are in possession of the private key, do the following:

    $ chmod 600 path/to/mykey.pem
    $ ssh -i path/to/mykey.pem root@ec2-X-X-X.compute-X.amazonaws.com
    

    My EC2 instance was created from a Ubuntu 32-bit 12.04 image, whose configuration does not allow ssh access to root, and asks you to log in as ubuntu instead:

    $ ssh -i path/to/mykey.pem ubuntu@ec2-X-X-X.compute-X.amazonaws.com
    

    Cheers, Giuseppe

提交回复
热议问题