Not able to login to EC2 running Oracle Linux(Custom AMI)


Hello Experts,
I am new to AWS and trying out migrating my OS(Oracle Linux 6) into AWS.
However,when i am trying to login to the EC2 ip, i am getting error message "Server refused our key". Not sure if this has anything related to improper migration that i did.I have given high level steps that i used to create a custom AMI.
I has used users "root","oracle"(OS users available in my on premise VM) & "ec2-user".How ever each time i got same login error. Could anyone help me in understanding what is wrong?

Creating Custom AMI:-

  1. Exported my Oracle Linux 6 VM as an ova file
  2. Copied that to S3 bucket
  3. After creating required roles and all,ran the ec2 import image function as below
    aws ec2 import-image --description "My Custom VM" --disk-containers "file://D:\containers.json"

where below is content of containers.json file

"Description": "My OELCustom OVA",
"Format": "ova",
"UserBucket": {
"S3Bucket": "mycustomami",
"S3Key": "Test.ova"

  1. After the image import task was completed,I could see the new AMI in my AMI console section
  2. I spinned up a new Ec2 with this AMI having port 22 & other ports open for all traffic.
    PEM file was downloaded.
  3. The EC2 came in to RUnning status with all status checks completed without any issues.
asked 3 years ago66 views
1 Answer

To solve this issue,create a public key in the source machine & connect to the ami after importing the public key to your aws account

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions