After restoring a RHEL 7.x instance, yum update stops working

After restoring a RHEL 7.x instance, yum update stops working

After restoring a RHEL 7.x instance, yum update stops working:

[root@hostname~]# yum update
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
epel/x86_64/metalink                                                                                                                                                                            |  25 kB  00:00:00
https://rhui2-cds02.eu-west-1.aws.ce.redhat.com/pulp/repos//rhui-client-config/rhel/server/7/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 401 - Unauthorized
Trying other mirror.
https://rhui2-cds01.eu-west-1.aws.ce.redhat.com/pulp/repos//rhui-client-config/rhel/server/7/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 401 - Unauthorized
Trying other mirror.

This is a known problem with RHEL, not specific to CPM.
The reason is that the restore was done using an AMI created from a snapshot.
This AMI does not have the required billing code attached to it and therefore can't be authenticated.
 
You can try the following workaround:

1) Do image based backup, if the default AMI does not exist anymore, please try to find the closest public AMI available (closest RHEL version) and try to use its ID, exclude all the volumes (except root device)
2) After the instance launches stop it and wait until in "stopped" state.
3) Go to the same backup and click Recovery->Volumes Only
4) Choose switch original volumes at the drop-down menu
5) Make sure all the volumes are restored in the AZ the new server is in (if its in the same AZ as the original server, you don't need to change anything).
6) For each one, choose to attach it  to the new instance (make sure it's the right one)
7) After you finish the recovery start the server again