hashicorp / hashicorp/packer-plugin-amazon
Packer stucks on amazon-ebs: \ Amazon Ec2 Launch - Instance I... Ready
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
_This issue was originally opened by @jasmisbvb in https://github.com/hashicorp/packer/issues/11707 and has been migrated to this repository. The original issue description is below._
---
i'm trying to create custom windows ami via packer but ami creation hangs without any error only when i'm trying to install docker using below command or while installing trend micro agent. Tried increasing size of the volume, type of the instance but didn't worked.
# Install Docker
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module DockerMsftProvider -Force
Install-Package Docker -ProviderName DockerMsftProvider -Force -RequiredVersion 20.10.0
amazon-ebs:
amazon-ebs: TaskPath TaskName State
amazon-ebs: -------- -------- -----
amazon-ebs: \ Amazon Ec2 Launch - Instance I... Ready
Github action flow: https://github.com/patrontech/packer-ansible-github-actions
packer.json
{
"builders": [{
"type": "amazon-ebs",
"communicator": "winrm",
"associate_public_ip_address": true,
"disable_stop_instance": "{{user `disable_stop_instance`}}",
"encrypt_boot": true,
"user_data_file": "main/SetUpWinRM.ps1",
"winrm_use_ntlm": true,
"winrm_timeout": "15m",
"winrm_insecure": true,
"winrm_use_ssl": true,
"region": "{{user `region`}}",
"instance_type": "t3.2xlarge",
"iam_instance_profile": "Packer",
"ami_users": "{{user `account_ids`}}",
"vpc_id": "vpc-xxxxxx",
"subnet_id": "subnet-xxxxxx",
"security_group_id": "sg-xxxxxxx",
"winrm_username": "Administrator",
"force_delete_snapshot": "{{user `force_delete_snapshot`}}",
"force_deregister": "{{user `force_deregister`}}",
"kms_key_id": "{{user `kms_key_id`}}",
"ami_name": "{{user `ami_prefix`}}_{{user `ami_version`}}",
"launch_block_device_mappings": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": true,
"volume_size": "{{user `root_volume_size`}}",
"volume_type": "gp2"
}
],
"run_tags": {
"Name": "Packer Build",
"Purpose": "Packer Build"
},
"tags": {
"Name": "{{user `ami_prefix`}}_{{user `ami_version`}}",
"OS_Version": "WindowsServer2016",
"Release": "Latest",
"Purpose": "node",
"Encrypted": "yes",
"Base_AMI_Name": "{{ .SourceAMIName }}",
"Build_Date": "{{isotime \"2006-01-02\"}}",
"Build_Time": "{{isotime \"3:04PM\"}}",
"Build_At": "{{isotime}}",
"Hardened": "yes",
"Hardening_Benchmark": "CIS Level 1",
"Version": "{{user `ami_version`}}"
},
"source_ami_filter": {
"filters": {
"name": "{{user `base_ami_filter`}}"
},
"most_recent": true,
"owners": [
"{{user `base_ami_owner`}}"
]
}
}
],
"provisioners": [
{
"environment_vars": [
"Install_MPS={{user `install_mps`}}"
],
"scripts": [
"main/script.ps1"
],
"type": "powershell"
},
{
"pause_before": "30s",
"scripts": [
"main/UpdateEC2LaunchConfig.ps1"
],
"type": "powershell"
},
{
"type": "powershell",
"inline": [
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown"
]
}
],
"post-processors": [
{
"type": "manifest",
"output": "main/manifest.json"
}
],
"variables": {
"ami_prefix":"CIS_WindowsServer_2016",
"ami_version": "{{ env `ami_version` }}",
"disable_stop_instance": "false",
"force_deregister": "{{ env `force_deregister` }}",
"force_delete_snapshot": "{{ env `force_delete_snapshot` }}",
"account_ids": "{{ env `account_ids` }}",
"kms_key_id": "{{ env `kms_key_id` }}",
"root_volume_size": "60",
"base_ami_filter": "CIS Microsoft Windows Server 2016 Benchmark v1.3.0.4 - Level 1-*",
"base_ami_owner": "67xxxxxxxxx",
"region": "eu-central-1",
"install_mps": "true",
"java_version": "11.0.14.1",
"openssl_version": "1.1.1.1400"
}
}
Contributor guide
Assessment
This issue has not been assessed yet.