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

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 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-057e8deb1a4c3f35d \
--query "Reservations[*].Instances[*].PublicDnsName"

[
[
"ec2-34-201-101-26.compute-1.amazonaws.com"
]
]

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

$ ssh -i ~/.ssh/EffectiveDevOpsAWS.pem ec2-user@ ec2-34-201-101-26.compute-1.amazonaws.com

The authenticity of host 'ec2-34-201-101-26.compute-1.amazonaws.com (172.31.22.52)' can't be established.

ECDSA key fingerprint is SHA256:V4kdXmwb5ckyU3hw/E7wkWqbnzX5DQR5zwP1xJXezPU.

ECDSA key fingerprint is MD5:25:49:46:75:85:f1:9d:f5:c0:44:f2:31:cd:e7:55:9f.

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-34-201-101-26.compute-1.amazonaws.com,172.31.22.52' (ECDSA) to the list of known hosts.

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|


https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/

1 package(s) needed for security, out of 2 available

Run "sudo yum update" to apply all updates.
[ec2-user@ip-172-31-22-52 ~]$

If you experience any issues, add the -vvv option in your SSH command to troubleshoot it.

主站蜘蛛池模板: 建平县| 昆明市| 精河县| 鹤峰县| 九龙城区| 珠海市| 沂南县| 贵南县| 吴忠市| 衡水市| 漠河县| 云梦县| 吴堡县| 镇江市| 东光县| 成都市| 工布江达县| 崇信县| 新化县| 泸水县| 九龙城区| 兴义市| 铁力市| 昭通市| 来凤县| 侯马市| 四子王旗| 广河县| 安阳市| 虞城县| 长治县| 鄯善县| 墨竹工卡县| 渭源县| 平凉市| 图木舒克市| 高密市| 江达县| 瑞昌市| 顺平县| 天津市|