I have been following a tutorial on LinuxAcademy to setup a VPC and EC2 instance. I have done everything correctly and launched the instance and then ssh into it, I then tried to update yum and got this error:

Could not retrieve mirrorlist http://repo.us-east-2.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.us-east-2.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 5001 milliseconds')

 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: amzn-main/latest

So I have double checked the following:

  • have public elastic ip

  • IGW setup

  • public subnets setup and the ACL has ALL outbound traffic allowed on

  • security group is allowing all outbound traffic

Finally, while I was looking at these settings I was discontented from the instance and now when I try to ssh back in it just times out, also I cannot ping the ip remotely.

I have also tried rebooting the instance but that didnt help.

Edit: Here are my screenshots and also a diagram from the tutorial of what I am trying to setup








  • What did AWS support have to say when you reported your issue? – jscott Dec 13 '17 at 1:53
  • What about inbound traffic? This sounds like a firewall type issue - security groups and NACLs to be double checked. – Tim Dec 13 '17 at 1:55
  • Instead of rebooting the instance, stop it and then restart. This will usually launch the instance on new hardware. Rebooting keeps on the same hardware. Now check if you have access. If not go to the AWS EC2 console. Right-click on your instance (chose Actions) -> Instance Settings. Review the "Get System Log" and "Get Instance Snapshot". – John Hanley Dec 13 '17 at 1:58
  • Thanks guys, tried the stop/start and still the same. SG is set to allow all outbound TCP and for inbond SSH/HTTP on 22/80 and for, ACL the same. ACL rule numbers for inbound are 100 and 110 for SSH/HHTP and 100 for ALL TCP outbound. Taking a look at the log now but not sure what to look for, not seeing any major errors. I dont see a snapshot option or did you mean screenshot? For the latter it just shows the kernel release and then login cursor. – goblin_rocket Dec 13 '17 at 2:16
  • also, is SSH with keys the only way to access an instance? Is there no console access via the dashboard like on DigitalOcean? – goblin_rocket Dec 13 '17 at 2:24

Your issue is with your NACLs. You allow inbound on only on port 22/tcp and 80/tcp.

When you make a web connection its outbound on port 80 or 443 but it comes back at a random high port. Security groups are sort of stateful and will allow return connections but not network ACLs.

If you allow 1024-65535/tcp your web connections should work.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.