I’m trying to set up a Windows image on EC2. However, SSH times out; here’s what happens when I try:
PS C:\Users\Jesse\Infrastructure> packer build .\template.json
amazon-ebs: output will be in this color.
==> amazon-ebs: Prevalidating any provided VPC information
==> amazon-ebs: Prevalidating AMI Name: packer-example 1605725857
amazon-ebs: Found Image ID: ami-02b5cd5aa444bee23
==> amazon-ebs: Creating temporary keypair: <redacted>
==> amazon-ebs: Creating temporary security group for this instance: <redacted>
==> amazon-ebs: Authorizing access to port 22 from [0.0.0.0/0] in the temporary security groups...
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Adding tags to source instance
amazon-ebs: Adding tag: "Name": "Packer Builder"
amazon-ebs: Instance ID: <redacted>
==> amazon-ebs: Waiting for instance (<redacted>) to become ready...
==> amazon-ebs: Using ssh communicator to connect: <redacted>
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Timeout waiting for SSH.
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored after 6 minutes 6 seconds: Timeout waiting for SSH.
==> Wait completed after 6 minutes 6 seconds
==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Timeout waiting for SSH.
==> Builds finished but no artifacts were created.
PS C:\Users\Jesse\Infrastructure>
Here’s my template.json
file:
{
"min_packer_version": "1.6",
"variables": {
"aws_access_key": null,
"aws_secret_key": null
},
"sensitive-variables": [
"aws_access_key",
"aws_secret_key"
],
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "Windows_Server-2019-English-Full-Base-2020.11.11",
"root-device-type": "ebs"
},
"owners": [
"801119661308"
],
"most_recent": true
},
"instance_type": "t2.micro",
"ssh_username": "Administrator",
"communicator": "ssh",
"ami_name": "packer-example {{timestamp}}",
"disable_stop_instance": "true",
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 50,
"volume_type": "gp2",
"delete_on_termination": true
}
]
}
]
}
No provisioners yet; I’m just trying to get the thing built first. Any idea what I’m doing wrong?