Search code examples
amazon-ec2aws-vpc

Error in Custom VPC


What is the solution for this?? I am tried to setup new VPC from Scratch. I have created a VPC with CIDR 10.0.0.0/16 in Mumbai region. And Created a Internet Gate way and attached to these VPC. Created Two subnets 1)10.0.1.0/24,With Public IP, In Availability Zone US-East-1a 2)10.0.2.0/24 With out public Ip,In Availability Zone US-East-1b Both subnets are in different zones

Creates TWO Route tables 1.Route table1 with Public subnet(10.0.1.0/24) and added Internet Gateway. 2.Route Table2 with Private Subnet(10.0.2.0/24) WITHOUT internet Gateway

Modified the default NETWORK ACL's to allow inbound traffic for only HTTP,HTTPS,TELNET,SSH For Outbound Traffic -ALLOW ALL

And I launched a EC2 instance with PUBLIC SUBNET(10.0.1.0/24) These EC2 instance have Public IP and Private Ip. And EC2 Security group INBOUND- HTTP,HTTPS,SSH for 0.0.0.0/0 Outbound -ALL for 0.0.0.0/0

I am able to login into ec2 console and sudo -i to become sudo user

confirmed i am able to connect to the internet properly

 ping 8.8.8.8
 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
 64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=1.27 ms
 64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=1.39 ms
 64 bytes from 8.8.8.8: icmp_seq=3 ttl=56 time=1.43 ms
 ^C
 --- 8.8.8.8 ping statistics ---
 3 packets transmitted, 3 received, 0% packet loss, time 2003ms
 rtt min/avg/max/mdev = 1.270/1.366/1.438/0.082 ms

then when i try to do yum update -y or trying to do yum install httpd

I am getting bellow error

"# yum update -y

 Loaded plugins: priorities, update-motd, upgrade-helper
 Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list error was
 12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list: (28, 
 'Resolving timed out after 5515 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
    compromise:

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

As I launched instance with Public Ip and have Internet Gateway and opened HTTP,HTTPS,SSH ports for ec2 instance level and for VPC level -HTTP,HTTPS,SSH,TELENET is opened for inbound , Still getting the above error.?


Solution

  • I think you have to enable DNS resolution for your custom VPC that might solve your problem.