官术网_书友最值得收藏!

Connecting to the EC2 instance using ssh

The main goal of this chapter is to create a simple Hello World web application. Since we are starting off with a vanilla OS, we need to connect to the host to make the necessary changes to turn our standard server into a web server. In order to ssh our instance, we need to find the DNS name of our running instance, as follows:

$ aws ec2 describe-instances \
  --instance-ids i-97000624 \
  --query "Reservations[*].Instances[*].PublicDnsName"
[
  [
    "ec2-54-88-134-38.compute-1.amazonaws.com"
  ]
]  

We now have the public DNS name of our instance and the private key to ssh into our instance. The last thing to know is that in Amazon Linux for the OS that we selected when we chose our AMI, the default user account is called ec2-user:

$ ssh -i ~/.ssh/EffectiveDevOpsAWS.pem ec2-user@ec2-54-88-134-38.compute-1.amazonaws.com
    
           __|  __|_  )
           _|  (     /   Amazon Linux AMI
          ___|\___|___|
    
[ec2-user@ip-172-31-22-234 ~]$  

If you experience any sort of issue, add the -vvv option in your ssh command to troubleshoot it.

主站蜘蛛池模板: 虹口区| 武义县| 商洛市| 炎陵县| 白玉县| 龙泉市| 郁南县| 平定县| 西安市| 苏尼特右旗| 同江市| 岐山县| 建德市| 资阳市| 大同市| 天等县| 东辽县| 渝北区| 托里县| 林西县| 临西县| 启东市| 望谟县| 盖州市| 天全县| 嫩江县| 诸暨市| 响水县| 溧水县| 如皋市| 河西区| 佛学| 历史| 南开区| 呼玛县| 南城县| 昆山市| 勃利县| 大同市| 渭南市| 洛川县|