1. How to configure VPC and subnets in AWS with the aws-native provider?


    In your Pulumi program, you will first create a VPC (Virtual Private Cloud), then create a subnet within that VPC. To achieve this, you will use two aws-native resources: aws-native.ec2.Vpc to create a VPC and aws-native.ec2.Subnet to create a subnet within the VPC.

    Here is a TypeScript program that accomplishes this:

    import * as pulumi from "@pulumi/pulumi"; import * as awsNative from "@pulumi/aws-native"; // Create an AWS VPC const vpc = new awsNative.ec2.Vpc("vpc", { cidrBlock: "" }); // Create a subnet in the VPC const subnet = new awsNative.ec2.Subnet("subnet", { vpcId: vpc.id, cidrBlock: "" }); // Export the VPC and subnet IDs export const vpcId = vpc.id; export const subnetId = subnet.id;

    This program first creates a VPC with its network range set to It then creates a subnet within the newly created VPC with a narrower network range of The ID of the VPC and subnet are then exported for further use.