The workaround used to know if the instance is inside a VPC isn't working for me, I launched a EC2 instance and I assigned an Elastic IP (all these using cloud formation), when cloud-init gets the metadata this is what it gets:
As you can see the field public-ipv4 appears in the metadata, so cloud-init thinks the instance isn't running in a VPC and sets the apt mirror to us-east1... and it takes me to the original situation. No access to the repositories.
The workaround used to know if the instance is inside a VPC isn't working for me, I launched a EC2 instance and I assigned an Elastic IP (all these using cloud formation), when cloud-init gets the metadata this is what it gets:
# curl http:// 169.254. 169.254/ latest/ meta-data/ mapping/
ami-id
ami-launch-index
ami-manifest-path
block-device-
hostname
instance-action
instance-id
instance-type
kernel-id
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-ipv4
public-keys/
reservation-id
security-groups
$ curl http:// 169.2st/ meta-data/ public- ipv4
184.72.x.x
As you can see the field public-ipv4 appears in the metadata, so cloud-init thinks the instance isn't running in a VPC and sets the apt mirror to us-east1... and it takes me to the original situation. No access to the repositories.
I fixed this behavior with the sugested key in cloud-config.yaml (apt_mirror: http:// us.archive. ubuntu. com/ubuntu/).