Open your CDK project and create a new stack named VpcStack.java.

Inherit from Stack from the awscdk library and create a constructor.

Define the VPC property and create a getter method.
VpcStack.java class:
private final Vpc vpc;
public Vpc getVpc() {
return vpc;
}

Initialize the VPC object in the constructor of VpcStack.java with the following code:
this.vpc = new Vpc(this, "Vpc", VpcProps.builder().build());

Next, name the VPC as ECommerceVPC and specify the number of Availability Zones as 2 using the following code:
.vpcName("ECommerceVPC")
.maxAzs(2)

If you want your VPC to be public and not use a NAT Gateway, you can add the following code:
.natGateways(0)
You may choose not to use a NAT Gateway in a lab environment to save costs, but avoid doing this in a production environment.
