Newtonian Physics Mockumentary

    @stackspot/cdk-vpc
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.1 • Public • Published

    vpc-env-jsii-component

    aws-cdk jsii npm-version nuget-version npm-downloads nuget-downloads license

    Component to create a VPC.

    How to use

    Below are all languages supported by the AWS CDK.

    C#

    Install the dependency:

    dotnet add package StackSpot.Cdk.Vpc

    Import the construct into your project, for example:

    using Amazon.CDK;
    using Constructs;
    using StackSpot.Cdk.Vpc;
    
    namespace MyStack
    {
        public class MyStack : Stack
        {
            internal MyStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
            {
                Vpc vpc = new Vpc(this, "MyVpc", new VpcProps {
                    VpcName = "MyVpc"
                });
            }
        }
    }

    F#

    Not yet supported.

    Go

    Not yet supported.

    Java

    Not yet supported.

    JavaScript

    Install the dependency:

    npm install --save @stackspot/cdk-vpc

    Import the construct into your project, for example:

    const { Stack } = require('aws-cdk-lib');
    const { Vpc } = require('@stackspot/cdk-vpc');
    
    class MyStack extends Stack {
      constructor(scope, id, props) {
        super(scope, id, props);
    
        const vpc = new Vpc(this, 'MyVpc', { vpcName: 'MyVpc' });
      }
    }
    
    module.exports = { MyStack };

    Python

    Not yet supported.

    TypeScript

    Install the dependency:

    npm install --save @stackspot/cdk-vpc

    Import the construct into your project, for example:

    import { Stack, StackProps } from 'aws-cdk-lib';
    import { Construct } from 'constructs';
    import { Vpc } from '@stackspot/cdk-vpc';
    
    export class MyStack extends Stack {
      constructor(scope: Construct, id: string, props?: StackProps) {
        super(scope, id, props);
    
        const vpc = new Vpc(this, 'MyVpc', { vpcName: 'MyVpc' });
      }
    }

    Construct Props

    Using an existing VPC

    Name Type Description
    vpcDefault boolean Whether to match the default VPC.
    vpcId string The identifier of the VPC to be used.
    vpcRegion string Optional to override inferred region.
    vpcName string The VPC name.

    Creating a VPC

    Name Type Description
    vpcCidr string If don't inform the vpcId, a VPC with this CIDR will be created. Default: 10.0.0.0/16.
    vpcMaxAzs number Define the maximum number of AZs to be used. Default: 99.
    vpcName string The VPC name.
    vpcSubnetConfiguration SubnetConfiguration[] Specify configuration parameters for a single subnet group in a VPC.

    Subnets

    Name Type Description
    subnetsAvailabilityZones string[] Select subnets only in the given AZs.
    subnetsGroupName string Select the subnet group with the given name.
    subnetIds string[] The identifiers of the subnets to be used.
    subnetsOnePerAz boolean If true, return at most one subnet per AZ.
    subnetsType SubnetType Type of subnet to be used. Default: SubnetType.PUBLIC

    Another Props

    ApiVpcEndpointCreateProps

    Name Type Description
    stackName string The name of the Stack
    securityGroupId string The identifier of the security id to be used on VPC Endpoint. (Optional)
    subnetType SubnetType The type of subnet to use.
    port number The port to be used by service linked to VPC Endpoint
    vpc IVpc The VPC to use.

    Properties

    Name Type Description
    subnets SubnetSelection Subnets used on the VPC.
    virtualPrivateCloud IVpc VPC to be used.

    Methods

    Name Description
    static createApiVpcEndpoint(scope, props) Create a VPC Endpoint.

    createApiVpcEndpoint(scope, vpc, props)

    public static createApiVpcEndpoint(scope: Construct,vpc: IVpc,props: ApiVpcEndpointCreateProps)

    Parameters

    Create a VPC Endpoint from an existing VPC.

    IAM Least privilege

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "ec2:AllocateAddress",
            "ec2:AssociateRouteTable",
            "ec2:AttachInternetGateway",
            "ec2:CreateInternetGateway",
            "ec2:CreateNatGateway",
            "ec2:CreateRoute",
            "ec2:CreateRouteTable",
            "ec2:CreateSubnet",
            "ec2:CreateTags",
            "ec2:CreateVpc",
            "ec2:DeleteInternetGateway",
            "ec2:DeleteNatGateway",
            "ec2:DeleteRoute",
            "ec2:DeleteRouteTable",
            "ec2:DeleteSubnet",
            "ec2:DeleteTags",
            "ec2:DeleteVpc",
            "ec2:DescribeAddresses",
            "ec2:DescribeAvailabilityZones",
            "ec2:DescribeInternetGateways",
            "ec2:DescribeNatGateways",
            "ec2:DescribeRouteTables",
            "ec2:DescribeSubnets",
            "ec2:DescribeVpcs",
            "ec2:DetachInternetGateway",
            "ec2:DisassociateRouteTable",
            "ec2:ModifySubnetAttribute",
            "ec2:ModifyVpcAttribute",
            "ec2:ReleaseAddress",
            "ec2:ReplaceRoute",
            "ssm:GetParameters"
          ],
          "Resource": "*"
        }
      ]
    }

    Development

    Prerequisites

    Setup

    cd vpc-jsii-component
    npm install

    Keywords

    Install

    npm i @stackspot/cdk-vpc

    DownloadsWeekly Downloads

    0

    Version

    0.2.1

    License

    Apache-2.0

    Unpacked Size

    1.02 MB

    Total Files

    21

    Last publish

    Collaborators

    • stackspotadmin