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

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.

主站蜘蛛池模板: 岳西县| 安塞县| 安徽省| 枣庄市| 朝阳区| 呼伦贝尔市| 永济市| 平陆县| 广灵县| 舒兰市| 长丰县| 泗阳县| 东至县| 白山市| 扎兰屯市| 田阳县| 嵩明县| 盐津县| 德庆县| 衡东县| 武鸣县| 丹阳市| 深泽县| 合水县| 区。| 呼玛县| 西乌珠穆沁旗| 闽侯县| 和田市| 沾化县| 墨江| 祥云县| 晋城| 古丈县| 缙云县| 都匀市| 石城县| 博乐市| 二连浩特市| 鹤山市| 仙游县|