0 votes
1 view
in AWS by (11.7k points)

I created a micro ec2 instance. Installed all the necessary web software, mysql and git. Created an AMI out of that instance. Since that instance was using EBS as its root device, it took an EBS snapshot as well when I was creating my AMI.

I terminated that running instance. I then tried creating an instance out that amazon machine image (AMI), the new instance started along with a new EBS volume getting attached to the instance.

Now when I use my key pair to login to that instance via my ssh key to its public DNS address with a command as

ssh -i aws/mykey.pem [email protected]

it says

ssh: connect to host <thepublickdnsname> port 22: Connection refused

Why is this happening. I was able to connect to my first instance with the same keys via ssh. Now the new instance is the exact copy and im not able to login to it. Any help on this? Am I missing something?

I used the same key pairs to create the second new instance from the AMI.

1 Answer

0 votes
by (18.6k points)

I was in the situation and found out that it can take a variable amount of time for the EC2 instance to get initialized. Just give it a few minutes(let the state change from pending to running and let it get initialized). After that, you'll be able to SSH into the instance without any trouble.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...