Has anyone ever ran into the following error? I have a rhel-9 ami that I want packer to build on top of, but for some reason it keeps erroring out.
> Red Hat Enterprise Linux 9 for x86_64 - AppStre 0.0 B/s | 0 B 04:00
> ==> amazon-ebs.rhel: Errors during downloading metadata for repository 'rhel-9-appstream-rhui-rpms':
> ==> amazon-ebs.rhel: - Curl error (6): Couldn't resolve host name for https://rhui.us-west-2.aws.ce.redhat.com/pulp/mirror/content/dist/rhel9/rhui/9/x86_64/appstream/os [Could not resolve host: rhui.us-west-2.aws.ce.redhat.com]
> ==> amazon-ebs.rhel: Error: Failed to download metadata for repo 'rhel-9-appstream-rhui-rpms': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://rhui.us-west-2.aws.ce.redhat.com/pulp/mirror/content/dist/rhel9/rhui/9/x86_64/appstream/os [Could not resolve host: rhui.us-west-2.aws.ce.redhat.com]
> ==> amazon-ebs.rhel: Provisioning step had errors: Running the cleanup provisioner, if present...
Looks like RHUI is not available. Your instance network configuration is not correct, this has nothing to do with Packer.
RHUI is an infrastructure (a product of Red Hat) that cloud companies use to mirror official Red Hat repositories and serve it within regional datacenters.
Thanks! Do you know where packer default creates the instances? When I use the base RedHat owned ami, I have no problems, but when I use one that I own, I keep getting this error?
The official Red Hat AMIs use RHUI infrastructure provided by Amazon therefore the hostnames you see do properly resolve.
By your “own” instance I assume you mean ones with have your own subscription, then you need to have the subscription manager configured against the official Red Hat CDN which is not provided by Amazon but a different provider Akamai.
It looks like the instance is missing subscription which was previously provided by Amazon, probably you started some old snapshot or something. If you want to launch an instance from your own Red Hat subscription contract, I highly suggest using Image Builder provided by Red Hat to do that. You can use one for free at Red Hat Console, or build images locally on RHEL. It is all documented.
Coincidentally, I am from Red Hat and I came here to ask a question about plugin development because I am working on Packer plugin for Red Hat Image Builder so official Red Hat AMI build process can be more easily automated. Let me know if you are interested in trying it out, it is in early stages of development but we would love to hear feedback.