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

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.

主站蜘蛛池模板: 普兰店市| 迭部县| 克山县| 开封县| 响水县| 崇义县| 汶上县| 平江县| 东丽区| 屏南县| 宁城县| 江北区| 贵德县| 贡山| 东兰县| 荥经县| 天台县| 桃江县| 浮山县| 天等县| 天柱县| 阿图什市| 曲靖市| 宁晋县| 祥云县| 连平县| 黑龙江省| 文成县| 瑞金市| 安顺市| 晴隆县| 兴城市| 永登县| 广河县| 新郑市| 永泰县| 元谋县| 安岳县| 沙雅县| 夏邑县| 苍溪县|