Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error waiting for AMI: Failed with ResourceNotReady error, which can have a variety of causes #13258

Open
lmayorga1980 opened this issue Jan 15, 2025 · 0 comments
Labels

Comments

@lmayorga1980
Copy link
Contributor

lmayorga1980 commented Jan 15, 2025

Overview of the Issue

Consistently getting ResourceNotReady: exceeded wait attempts errors using a high performance instance type.

Reproduction Steps

Use the following AWS Source AMI and use a specific instance_type => m5.large.

aws ec2 describe-images --owners self amazon --filters "Name=name,Values=Windows_Server-2019-English-Full-SQL_2019_Standard-????.??.??" "Name=root-device-type,Values=ebs" | jq -r '.Images| sort_by(.CreationDate)' | jq -r '.[].Name'

Packer works fine until is time to wait for aws to return the ami response and crashes with

==> amazon-ebs.sql2019-full: Waiting for AMI to become ready...
--
2555 | ==> amazon-ebs.sql2019-full: Error waiting for AMI: Failed with ResourceNotReady error, which can have a variety of causes. For help troubleshooting, check our docs: https://www.packer.io/docs/builders/amazon.html#resourcenotready-error
2556 | ==> amazon-ebs.sql2019-full: original error: ResourceNotReady: exceeded wait attempts

Packer version

v1.11.2

Simplified Packer Template


source "amazon-ebs" "sql2019-full" {
  communicator  = "winrm"
  region        = var.REGION
  ami_name      = var.AMI_NAME
  instance_type = "m5.large"
  iam_instance_profile = var.IAM_INSTANCE_PROFILE
  security_group_filter {
    filters = {
      "tag:Type" : "windows"
    }
  }
  vpc_filter {
    filters = {
      "tag:Name" : var.VPC_NAME,
      "isDefault" : "false"
    }
  }
  subnet_filter {
    filters = {
      "tag:Name" : var.AWS_SUBNET_FILTER
    }
    most_free = true
    random    = false
  }

  launch_block_device_mappings {
    device_name           = "/dev/sda1"
    delete_on_termination = true
    volume_size           = 75
    volume_type           = "gp3"
  }

  source_ami_filter {
    filters = {
      virtualization-type = "hvm"
      name                = "Windows_Server-2019-English-Full-SQL_2019_Standard-????.??.??"
      root-device-type    = "ebs"
    }
    owners      = [var.OWNER_ID]
    most_recent = true
  }

  user_data_file           = "../../scripts/win/common/ec2-userdata.ps1"
  windows_password_timeout = "30m"
  winrm_use_ssl            = true
  winrm_insecure           = true
  winrm_username           = var.ADMIN_USER
  winrm_timeout            = "6h"

  metadata_options {
    http_endpoint               = "enabled"
    http_tokens                 = "required"
    http_put_response_hop_limit = 1
  }
}

build {
  sources = [
    "source.amazon-ebs.sql2019-full"
  ]

  provisioner "powershell" {
  
    }
    inline = ["Write-Host Hello"]
  }
...

Operating system and Environment details

This runs in an Amazon Linux 2023 AWS Codebuild container with 3GB of memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant