Skip to main content
Version: 0.0.16


Create a VPC and a subnet within it‚Äč

Install the AWS virtual public cloud (VPC) module

SELECT * FROM iasql_install('aws_vpc');

Create an isolated VPC in which to create resources via the vpc table. Read more about VPC here. To create a VPC, specify a range of IPv4 addresses for the VPC in the form of a Classless Inter-Domain Routing (CIDR) block.

INSERT INTO vpc (cidr_block)
VALUES ('');

Now apply the VPC change to your cloud account

SELECT * FROM iasql_apply();

A VPC spans all of the Availability Zones in an AWS Region. After you create a VPC, you can add one or more subnets in each Availability Zone. The snippet below creates a non-default subnet in one of the availability zones within the newly created VPC

INSERT INTO subnet (availability_zone, vpc_id, cidr_block)
SELECT (select * from availability_zone limit 1), id, ''
FROM vpc
WHERE is_default = false
AND cidr_block = '';