Hi all, I’ve been able to run packer smoothly with a default VPC, but I have trouble getting the build to run properly with ssh to a private VPC. If I don’t add a shell provisioner, the AMI gets created normally. With a shell provisioner, I get a very generic error “Error uploading script: his account is currently not available.”. Can anyone help debug?
packer {
required_plugins {
amazon = {
version = ">= 1.2.8"
source = "github.com/hashicorp/amazon"
}
}
}
source "amazon-ebs" "onebox-xxx-image" {
ami_name = "onebox-xxx-${formatdate("YYYYMMDDhhmmss", timestamp())}"
instance_type = "g4dn.xlarge"
region = "us-west-2"
source_ami_filter {
filters = {
name = "*onebox-xxx*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["510079xxx"]
}
vpc_id = "vpc-xxx"
subnet_filter {
filters = {
"tag:Name" : "xxx*"
}
most_free = true
random = false
}
temporary_key_pair_type = "ed25519"
security_group_ids = ["sg-xxx"]
// ssh_interface = "private_ip"
// Use SSH
ssh_host = "bastion.xxx.tech"
ssh_port = "443"
ssh_username = "bastion"
ssh_bastion_agent_auth = true
ssh_timeout = "2m"
}
build {
name = "focal-packer"
sources = [
"source.amazon-ebs.onebox-XXX-image"
]
provisioner "shell" {
inline = [
"echo packer"
]
}
}
➜ focal git:(upgrade-onebox-images) ✗ packer build -on-error=ask .
focal-packer.amazon-ebs.onebox-focal-image: output will be in this color.
==> focal-packer.amazon-ebs.onebox-focal-image: Prevalidating any provided VPC information
==> focal-packer.amazon-ebs.onebox-focal-image: Prevalidating AMI Name: onebox-xxx-20240411212301
focal-packer.amazon-ebs.onebox-focal-image: Found Image ID: ami-xxx
focal-packer.amazon-ebs.onebox-focal-image: Found Subnet ID: subnet-xxx
==> focal-packer.amazon-ebs.onebox-focal-image: Creating temporary keypair: packer_xxx ==> focal-packer.amazon-ebs.onebox-focal-image: Launching a source AWS instance...
focal-packer.amazon-ebs.onebox-focal-image: Instance ID: i-xxx
==> focal-packer.amazon-ebs.onebox-focal-image: Waiting for instance (i-xxx) to become ready...
==> focal-packer.amazon-ebs.onebox-focal-image: Using SSH communicator to connect: bastion.pdx.l5.woven-planet.tech
==> focal-packer.amazon-ebs.onebox-focal-image: Waiting for SSH to become available...
==> focal-packer.amazon-ebs.onebox-focal-image: Connected to SSH!
==> focal-packer.amazon-ebs.onebox-focal-image: Provisioning with shell script: /var/folders/l5/2f4j8lm10dq36hq1yrj1dv1h0000gq/T/packer-shell1684447015
==> focal-packer.amazon-ebs.onebox-focal-image: Error uploading script: his account is currently not available.
==> focal-packer.amazon-ebs.onebox-focal-image: Step "StepProvision" failed
==> focal-packer.amazon-ebs.onebox-focal-image: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? c
==> focal-packer.amazon-ebs.onebox-focal-image: Provisioning step had errors: Running the cleanup provisioner, if present...
==> focal-packer.amazon-ebs.onebox-focal-image: Terminating the source AWS instance...
==> focal-packer.amazon-ebs.onebox-focal-image: Cleaning up any extra volumes...
==> focal-packer.amazon-ebs.onebox-focal-image: No volumes to clean up, skipping
==> focal-packer.amazon-ebs.onebox-focal-image: Deleting temporary keypair...
Build 'focal-packer.amazon-ebs.onebox-focal-image' errored after 49 minutes 13 seconds: Error uploading script: his account is currently not available.