How can I solve the sudo yum update error

Viewed 3233

I am in the process of installing jenkins on AWS EC2, but I am getting an error when I run sudo yum update The error is as attached below

[ec2-user@ip-172-31-28-76 ~]$ sudo yum update
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Could not retrieve mirrorlist http://amazonlinux.us-west-2.amazonaws.com/2/core/latest/x86_64/mirror.list error was
12: Timeout on http://amazonlinux.us-west-2.amazonaws.com/2/core/latest/x86_64/mirror.list: (28, 'Connection timed out after 5000 milliseconds')
http://amazonlinux.us-west-2.amazonaws.com/2/core/2.0/x86_64/b422f334d89b6a3434335c97d73abbbe22bcb300b803323cc35f60e37f3c2f03/repodata/repomd.xml?instance_id=i-09f9a88f2ec71204c&region=us-west-2: [Errno 12] Timeout on http://amazonlinux.us-west-2.amazonaws.com/2/core/2.0/x86_64/b422f334d89b6a3434335c97d73abbbe22bcb300b803323cc35f60e37f3c2f03/repodata/repomd.xml?instance_id=i-09f9a88f2ec71204c&region=us-west-2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
http://amazonlinux.us-west-2.amazonaws.com/2/core/2.0/x86_64/b422f334d89b6a3434335c97d73abbbe22bcb300b803323cc35f60e37f3c2f03/repodata/repomd.xml?instance_id=i-09f9a88f2ec71204c&region=us-west-2: [Errno 12] Timeout on http://amazonlinux.us-west-2.amazonaws.com/2/core/2.0/x86_64/b422f334d89b6a3434335c97d73abbbe22bcb300b803323cc35f60e37f3c2f03/repodata/repomd.xml?instance_id=i-09f9a88f2ec71204c&region=us-west-2: (28, 'Connection timed out after 5000 milliseconds')
2 Answers

Validate that your instance has the ability to access the internet

  • If your instance is in a public subnet, make sure it has a public IP address and a internet gateway attached to the route table.
  • If your instance is in a private subnet, make sure it does not have a public IP address, a NAT Gateway or NAT instance is attached to the route table, and that the NAT Gateway/NAT instance are in a public subnet with routable traffic.

There is a problem with your Network ACL Inbound and Outbound rule. Also make sure that subnets are associated to the correct NACL. I came across a similar issue and spent some time to figure it out.

Steps performed:

  1. Cloud Trail
  2. Unfortunately, session manager didn't help

Tested and Verified

Related