packer-plugin-amazon icon indicating copy to clipboard operation
packer-plugin-amazon copied to clipboard

cannot access the alpine ec2 instance created from resultant AMI

Open ghost opened this issue 4 years ago • 2 comments

This issue was originally opened by @ffoysal as hashicorp/packer#10293. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Created an AMI from source alpine AMI (alpine-ami-3.12.1-x86_64-r0). packer build was successful and produced the AMI. Can create an EC2 instance using the resultant AMI. But cannot ssh to the newly created EC2 instance using the same ssh-user, even though during the packer build the same user named alpine was successful. But ec2 instance created from source AMI (alpine-ami-3.12.1-x86_64-r0) can access it using the user named alpine

Reproduction Steps

  • packer build example.json
  • create ec2 instance using the newly produced AMI
  • try to do ssh ... alpine@<ec2-ip>
  • it will ask for password
ssh -i mykey.pem alpine@<ec2-ip>

alpine@<ec2-ip>'s password:

Packer version

Packer v1.6.5

Simplified Packer Buildfile

{
  "builders": [
    {
      "type": "amazon-ebs",
      "profile": "default",
      "region": "us-east-2",
      "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "alpine-ami-3.12.1-x86_64-r0",
          "root-device-type": "ebs"
        },
        "owners": ["538276064493"],
        "most_recent": true
      },
      "instance_type": "t2.micro",
      "ssh_username": "alpine",
      "ami_name": "packer-example {{timestamp}}"
    }
  ]
}

Operating system and Environment details

Mac OS catalina 10.15.7

ghost avatar Mar 29 '21 12:03 ghost