Skip to content

Conversation

@viren-nadkarni
Copy link
Contributor

@viren-nadkarni viren-nadkarni commented Apr 16, 2025

This PR implements the EC2 CreateDefaultSubnet operation.

CreateDefaultSubnet operation creates a default subnet with a size /20 IPv4 CIDR block in the specified Availability Zone in your default VPC. You can have only one default subnet per Availability Zone.

Moto already supports the EC2 CreateDefaultVpc and this is updated such that it also creates the default subnets.

The implementation assigns the /20 CIDR blocks to AZs in sequence as follows, but that's not always the case on AWS:

  • ...a: 172.31.0.0/20
  • ...b: 172.31.16.0/20
  • ...c: 172.31.32.0/20
  • etc.

@viren-nadkarni viren-nadkarni force-pushed the ec2-create-default-subnets branch from 95a7471 to b3cf7ea Compare April 16, 2025 09:56
@viren-nadkarni viren-nadkarni changed the title EC2: Implement CreateDefaultSubnets EC2: Implement CreateDefaultSubnet operation Apr 16, 2025
@viren-nadkarni viren-nadkarni force-pushed the ec2-create-default-subnets branch from 0fb6b62 to bb8885e Compare April 17, 2025 09:55
@viren-nadkarni viren-nadkarni force-pushed the ec2-create-default-subnets branch from b9c88de to 1149cbc Compare April 17, 2025 12:03
@viren-nadkarni viren-nadkarni force-pushed the ec2-create-default-subnets branch from 1149cbc to f01d97b Compare April 17, 2025 12:09
@viren-nadkarni viren-nadkarni marked this pull request as ready for review April 17, 2025 13:36
@codecov
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.82%. Comparing base (b29a9c8) to head (f01d97b).
Report is 33 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8818      +/-   ##
==========================================
+ Coverage   92.80%   92.82%   +0.01%     
==========================================
  Files        1261     1266       +5     
  Lines      109888   110530     +642     
==========================================
+ Hits       101986   102599     +613     
- Misses       7902     7931      +29     
Flag Coverage Δ
servertests 28.16% <71.79%> (-0.06%) ⬇️
unittests 92.79% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for improving the parity here @viren-nadkarni!

@bblommers bblommers added this to the 5.1.4 milestone Apr 19, 2025
@bblommers bblommers merged commit 4375dfc into getmoto:master Apr 19, 2025
103 of 108 checks passed
@viren-nadkarni viren-nadkarni deleted the ec2-create-default-subnets branch April 21, 2025 06:42
tekumara added a commit to seek-oss/aec that referenced this pull request May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants