Is AWS VPC CIDR shared with other accounts? - amazon-web-services

AWS creates default VPC with CIDR 10.0.0.0/16 or sometimes 172.31.0.0/16.
I created another AWS account & in that also same CIDR blocks were created.
So my question is
If 2 accounts have same CIDR blocks then is my number of subnets available shared by other accounts?
For for application, should I create my own VPC rather than using default one created by AWS?
Appreciate an answer

Two VPCs whether in the same account or different account can have the same CIDR BUT you cannot route traffic between them. ie., if the instances in the VPCs do not communicate.
If you really want to route traffic between them using internal IPs (using VPN etc.,) you MUST use a different CIDR, same account or different account does not matter.
If you have the same CIDR, the routing table will route the traffic internally when you intend to route it to the other VPC.

Related

CIDR added accidently another AWS VPC

I have accidently added a secondary CIDR to a VPC which was already being used by another VPC in another AWS account our company's private network . My question here is if the cidr was already being used , how was I allowed to add again to another VPC ? Also doesn't AWS provide a mechanism to check if the cidr range that we are trying to add is available or being used ?
You can have multiple VPCs with the same CIDR range. This is the benefit of the Cloud! It's great when you want non-production networks to exactly match Production networks. It's a feature, not a failure.
Having multiple VPCs with overlapping ranges will only be an inconvenience if you wish to connect those VPCs together, or you wish to be able to route to both VPCs from the same VPN or Direct Connect connection.

AWS VPC Endpoints: What's the different between the private DNS records

I'm new to AWS. I have deployed an interface endpoint in two subnets of my VPC. The endpoint comes with three domain names.
vpce-xxxxxxxxxxxxxxx-yjkfe3jc.vpce-svc-xxxxxxxxxxxxxxx.eu-central-1.vpce.amazonaws.com (Z273ZU8SZ5RJPC)
vpce-xxxxxxxxxxxxxxx-yjkfe3jc-eu-central-1a.vpce-svc-xxxxxxxxxxxxxxxx.eu-central-1.vpce.amazonaws.com (Z273ZU8SZ5RJPC)
vpce-xxxxxxxxxxxxxxx-yjkfe3jc-eu-central-1b.vpce-svc-xxxxxxxxxxxxxx.eu-central-1.vpce.amazonaws.com (Z273ZU8SZ5RJPC)
Two of them, which have the availability zone name inside their name, apparently points to the IP addresses of the ENIs in the subnets. However, I'm wondering what's the purpose of the first record(the one without AZ name)? And where are these records hosted or where to find the zone Z273ZU8SZ5RJPC?
Thanks!
First One is the regional DNS name of the endpoint, which will resolve to all the available zonal IP addresses associated with the endpoint.
[] Interface VPC endpoints (AWS PrivateLink) - Access a service through an interface endpoint - https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html#access-service-though-endpoint
If you have created a HA architecture, with multiple resources spanning across multiple AZs, then the regional endpoint can be used. A simpler example can be for load balancing, where you are distributing load across multiple AZs using Round-Robin DNS resolution.
Since the hosted zone is not visible in our own account, it must be something AWS managed and therefore, we cannot see the records present in it.

VPC Peering if both side VPC CIDR range is same?

Is there is any workaround if we have the same vpc cidr (different aws account )at both ends and we want VPC peering? Or any other mechanism which can help me to connect between two same VPC CIDR but in different aws account ??
The peering connection requires non-overlapping CIDRs.
Ensure that your VPCs do not have overlapping IPv4 CIDR blocks. If they do, the status of the VPC peering connection immediately goes to failed. This limitation applies even if the VPCs have unique IPv6 CIDR blocks.
A way to deal with such cases is to use secondary CIDR range. Such setup is exemplified in the AWS doc:
Two VPCs peered to a specific CIDR block in one VPC
In the example, VPC A has overlapping CIDR range with VPC B and C. To establish peering connection, extra CIDR ranges are used.
There is a good article in AWS blog which provides several solutions depending on your needs:
Renumber IP networks
Use AWS PrivateLink
Use multiple IP address ranges in VPCs
Hide subnets using Private NAT Gateway

Can an Elastic Beanstalk from one AWS account talk to RDS in another AWS account?

Security groups of Elastic Beanstalk is not recognised when adding to the Inbound Rules of RDS.
The error message is
Could not update your security group rules (No changes were made): The
security group 'sg-xxxxx' does not exist
Any help is much appreciated.
I think this would be possible by:
Peering the two relevant VPC's from account 1 and account 2. See: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-peering.html
Updating the route tables of the specific VPC's subnets to ensure that traffic to and from the relevant VPC's are routed correctly.
Updating the security group rules in account 2 for RDS to allow source traffic from the address range VPC that account 1 will connect from, e.g. allow inbound TCP/3306 FROM 10.0.1.0/24 as an example.
In order to provide more specific details I'd need to know the VPC CIDR range and subnet setup + configuration or route tables.

How can I get an AWS Application load balance to forward to a target group in a different vpc?

I've setup an Application Load Balancer in my primary VPC where most of my instances are. I have some instances in another VPC hosting docker services and I want to setup rules to access these at http://domain.com/services/. I have peering enabled between the two VPCs and I've created a target group, but the ALB only lists target groups within its own VPC. Is there any way to access the target group in the peered VPC or am I out of luck? I've been unable to find any leads on google so far. I've made sure the subnets in the ALB have routing through the VPC peering, but that hasn't helped.
You can load balance using ALBs and use the internal IP address of the peered VPC. You can do this via selecting the target type as ip when setting up the Target Group.
Amazon has a great write up on this exact problem and solution: https://aws.amazon.com/blogs/aws/new-application-load-balancing-via-ip-address-to-aws-on-premises-resources/
Since you are going VPC to VPC, substitute their "on premise" wording with "my other VPC". I just set this up using a host header routing for the ALB to cross two VPCs with a single ALB.
try with Route 53 routing policy. you can balance instance beyond the region also.