You probably install Ubuntu server in AWS and apt-get failed. It is not working because AWS NACLs are stateless. You need to allow inbound return traffic for the response.
Source: 0.0.0.0/0
Protocol: TCP
Port Rage: 32768-65535
Allow/Deny: ALLOW

Have a good one.