- Newest
- Most votes
- Most comments
Hi there.
After a lot of tests and researches, I understood the main problem. The EC2 Instance used as AMI Source was configured with Static IP address into Operating System Network configurations. It is a problem working with AMI. AWS recommends don't use Static IP when going to create an AMI. So, since that Source EC2 has a production workload and there is a requirement having Static IP Address configured to Network Interfaces, the AMI was taken from Production EC2 (in account "A") without any changes at Operating System level. But, at the moment of EC2 launch in Account "B" using created AMI, we specified a PowerShell Script into UserData field.
The PowerShell Script used to solve this problem follow below.
<powershell>
Set-NetIPInterface -InterfaceAlias "Ethernet" -Dhcp Enabled
Start-Sleep -Seconds 5
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses
</powershell>
Script above reconfigure the Network Interface to receive the IP by DHCP and reset DNS Server IP. Specifying this script in UserData field, we solve our problem.
answered a year ago
When you create an EC2 instance from a shared AMI in a different account and VPC, several network configuration settings from the original instance might be preserved in the AMI, which can cause connectivity issues. Here are the likely causes and solutions for your internet connectivity problem:
-
Network Configuration Persistence: The Windows instance might have network settings from the original environment (Account A) that are conflicting with the new environment (Account B). This includes saved network adapter configurations, static IP addresses, DNS settings, or proxy configurations.
-
Windows Firewall Settings: The Windows Firewall settings from the original instance might be blocking outbound internet traffic in the new environment.
-
Route Table Configuration: Even though you mentioned that internet routing is correctly configured, double-check that the subnet where your instance resides has a route to an Internet Gateway (0.0.0.0/0 pointing to an IGW).
-
Public IP Assignment: Verify that your EC2 instance has a public IP address assigned to it. Without a public IP, the instance won't be able to communicate with the internet even if the VPC has an Internet Gateway.
-
VPC and Subnet Settings: Ensure that the subnet is a public subnet with proper route table associations.
To resolve this issue:
- Reset the network configuration on the Windows instance:
- Connect to the instance using EC2 Instance Connect or Systems Manager Session Manager
- Reset TCP/IP stack using "netsh int ip reset"
- Release and renew IP address using "ipconfig /release" followed by "ipconfig /renew"
- Reset Windows Firewall to default settings
-
If the instance still can't connect to the internet, try stopping and starting the instance (not just rebooting) which will migrate it to a new host and might resolve networking issues.
-
As a last resort, you might need to create a new AMI in Account A with more generalized network settings before sharing it with Account B.
Since your test with an AWS Managed AMI worked successfully in Account B, this confirms that the issue is specific to the shared AMI rather than your VPC configuration.
Sources
Internet Connectivity Issue: EC2 Instance Cannot Access the Internet | AWS re:Post
EC2 instance from Snapshot not accessible | AWS re:Post
EC2 internet inbound/outbound not working us-east-1, works in all other regions | AWS re:Post
answered a year ago
Relevant content
- AWS OFFICIALUpdated 7 months ago

The new EC2 instance created on Account "B" has an Elastic IP associated to it. Route table associated to subnet is configured appropriately with route to IGW.