I am trying to make a packer image, but on our amazon account we DO NOT have a default VPC. It has been removed. And have been getting this error when trying to pack the image:
==> amazon-instance: Inspecting the source AMI...
==> amazon-instance: Creating temporary keypair: packer 54cfd9c9-61ef-5f8f-4091-d27e731a8a4d
==> amazon-instance: Creating temporary security group for this instance...
==> amazon-instance: No default VPC for this user (VPCIdNotSpecified)
==> amazon-instance: Deleting temporary keypair...
Build 'amazon-instance' finished.
Therefore I am supposed to specify a default VPC id or subnet id.
I have tried both,
{
"variables": {
"vpc_id ": "vpc-962438f4",
"subnet_id": "subnet-1c5d5c68"
},
"builders": [{
"type": "amazon-instance",
"access_key": "somekey"
"secret_key": "somekey"
"account_id": "AccountIDNUMBER"
"region": "ap-southeast-2",
"source_ami": "ami-b7eb9e8d",
"s3_bucket": "layer2amis",
"x509_cert_path": "packer/cert-x509.pem",
"x509_key_path": "packer/key-x509.pem",
"instance_type": "t2.medium",
"ssh_username": "ubuntu",
"ssh_timeout": "5m",
"ami_virtualization_type": "hvm",
"ami_name": "layer2_stagingserver_{{timestamp}}",
"bundle_vol_command": "sudo -n /usr/local/ec2/ec2-ami-tools-1.5.3/bin/ec2-bundle-vol -k {{.KeyPath}} -u {{.AccountId}} -c {{.CertPath}} -r {{.Architecture}} -e {{.PrivatePath}}/* -d {{.Destination}} -p {{.Prefix}} --batch --no-filter",
"bundle_upload_command": "sudo -n /usr/local/ec2/ec2-ami-tools-1.5.3/bin/ec2-upload-bundle -b {{.BucketName}} -m {{.ManifestPath}} -a {{.AccessKey}} -s {{.SecretKey}} -d {{.BundleDirectory}} --region ap-southeast-2 --batch --retry"
}],
}
The documentation on the web for packer just says vpc_id (string) - If launching into a VPC subnet, Packer needs the VPC ID in order to create a temporary security group within the VPC.