Check Instance Status
Creating Elastic IP & Associate Elastic IP to Instance
Elastic IP is the static public IP that provided by AWS. When we create instance then we will get the dynamic private IP address attached with instance. Private IP always changed when we reboot/ stop instance. So, we will connect static public ip with instance. Follow below step to create Elastic Ip and associate to our instance:
Go to Elastic Ip
Click on the Elastic IPs under the Network & Security section of EC2 Dashboard.
Allocate Elastic IP Address
Allocate Public IPv4 address pool
Allocate an Elastic IP address by selecting the public IPv4 address pool from which the public IP address is to be allocated. Elastic IP addresses incur charges if they are not associated with a running instance or a network interface that is attached to a running instance. Click on the Allocate button to create Elastic IP.
Associate Elastic IP address
Set the Permission of Key File
In the previous tutorial, we downloaded the key file. Make sure our key (pem file) matches with instance key pair name. Set the permission 400 permission of key file.
$ chmod 400 OUR_KEY.pem;
Login to Ec2 using SSH
Now, we can connect via Public DNS (IPv4). Open terminal & use the below command:
$ ssh -i /PATH/OUR_KEY.pem user_name@public_dns_name
Finally, we login to EC2 instance using SSH.