1. Packages
  2. AWSx (Pulumi Crosswalk for AWS)
AWSx (Pulumi Crosswalk for AWS) v2.6.0 published on Friday, Mar 1, 2024 by Pulumi

AWSx (Pulumi Crosswalk for AWS)

awsx logo
AWSx (Pulumi Crosswalk for AWS) v2.6.0 published on Friday, Mar 1, 2024 by Pulumi

    The Amazon Web Services (AWS) Crosswalk (AWSx) library uses automatic well-architected best practices to make common infrastructure-as-code tasks in AWS easier and more secure. It uses the AWS SDK to manage and provision resources.

    The AWSx provider must be configured with credentials to deploy and update resources in AWS; see Installation & Configuration for instructions.

    New to Pulumi and AWS? Get started with AWS using our AWSx tutorial.

    Example

    import * as awsx from "@pulumi/awsx";
    
    // Allocate a new VPC with the default settings:
    const vpc = new awsx.ec2.Vpc("custom");
    
    // Export a few resulting fields to make them easy to use:
    export const vpcId = vpc.vpcId;
    export const privateSubnetIds = vpc.privateSubnetIds;
    export const publicSubnetIds = vpc.publicSubnetIds;
    
    import pulumi
    import pulumi_awsx as awsx
    
    vpc = awsx.ec2.Vpc("custom")
    
    pulumi.export("vpcId", vpc.vpc_id)
    pulumi.export("publicSubnetIds", vpc.public_subnet_ids)
    pulumi.export("privateSubnetIds", vpc.private_subnet_ids)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-awsx/sdk/go/awsx/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		vpc, err := ec2.NewVpc(ctx, "my-vpc", nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcId", vpc.VpcId)
    		ctx.Export("privateSubnetIds", vpc.PrivateSubnetIds)
    		ctx.Export("publicSubnetIds", vpc.PublicSubnetIds)
    		return nil
    	})
    }
    
    using Pulumi;
    using Ec2 = Pulumi.Awsx.Ec2;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var vpc = new Ec2.Vpc("custom");
    
            this.VpcId = vpc.VpcId;
        }
    
    
        [Output] public Output<string> VpcId { get; set; }
    }
    
    class Program
    {
        static Task<int> Main(string[] args) => Deployment.RunAsync<MyStack>();
    }
    
    package myproject;
    
    import com.pulumi.Pulumi;
    import com.pulumi.awsx.ec2.Vpc;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var vpc = new Vpc("custom");
    
                ctx.export("vpcId", vpc.vpcId());
                ctx.export("privateSubnetIds", vpc.privateSubnetIds());
                ctx.export("publicSubnetIds", vpc.publicSubnetIds());
            });
        }
    }
    
    name: awsx-networking-yaml
    runtime: yaml
    description: A minimal AWS Pulumi YAML program
    
    resources:
      # Allocate a new VPC with the default settings:
      vpc:
        type: awsx:ec2:Vpc
    
    outputs:
      vpcId: ${vpc.vpcId}
      privateSubnetIds: ${vpc.privateSubnetIds}
      publicSubnetIds: ${vpc.publicSubnetIds}
    
    awsx logo
    AWSx (Pulumi Crosswalk for AWS) v2.6.0 published on Friday, Mar 1, 2024 by Pulumi