How do I set up SSH access for an Amazon EC2 instance?

后端 未结 13 1427
挽巷
挽巷 2021-01-29 19:20

I need SSH access to an Amazon EC2 instance running Ubuntu 10.4. All I have is the Amazon username and password. Any ideas?

13条回答
  •  逝去的感伤
    2021-01-29 19:24

    To setup Ubuntu on AWS, please follow the following steps:

    1. Log-in to Amazon Web Services and select EC2.
    2. Choose Launch Instance and follow wizard by selecting the right image (Ubuntu), instance type, configuring VPC network and Subnet, storage and allowing SSH access in Security Groups. Then Launch.
    3. For the first time, you probably need to setup the key pair and assign it to the instance. You can also create key pair in Key Pairs. Once created, download the PEM file and keep it in a safe place.
    4. Once the instance is launched, wait until the instance is Initialized and running.

    To access the instance via SSH, run:

    1. Connect to Linux box by specifying your PEM file, e.g.

      ssh -i "file.pem" ubuntu@x.x.x.x
      

      Make sure your PEM file has 600 permission (chmod 600 file.pem).

    Troubleshooting

    If you're running VPC instance, and your security group is correct (with the right rules) and it still doesn't work, in VPC section check your subnet which should be attached to your VPC (both used by your instance) and setup new rule in Route Table that has 0.0.0.0/0 as Destination and your Internet Gateway as Target.

    For more details check: Troubleshooting Connecting to Your Instance

    See also: Possible reasons for timeout when trying to access EC2 instance

提交回复
热议问题