@orange-stack/vpc-env-component
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

vpc-env-jsii-component

Component to create a VPC.

How to use

Below are all languages supported by the AWS CDK.

C#

Install the dependency:

dotnet add package OrangeStack.Components.Env.Vpc

Import the construct into your project, for example:

using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Constructs;
using OrangeStack.Components.Env.Vpc;

namespace MyStack
{
    public class MyStack : Stack
    {
        internal MyStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            string[] subnetsIds = {
                "subnet-xxxxxxxxxxxxxxxxx",
                "subnet-xxxxxxxxxxxxxxxxx",
                "subnet-xxxxxxxxxxxxxxxxx"
            };

            VpcEnvComponent vpcEnvComponent = new VpcEnvComponent(this, "MyVpc", new VpcEnvComponentProps{
                SubnetsIds = subnetsIds,
                SubnetsType = SubnetType.PRIVATE_ISOLATED,
                VpcId = "vpc-xxxxxxxxxxxxxxxxx"
            });
        }
    }
}

F#

Not yet supported.

Go

Not yet supported.

Java

Not yet supported.

JavaScript

Install the dependency:

npm install --save @orange-stack/vpc-env-component

Import the construct into your project, for example:

const { Stack } = require('aws-cdk-lib');
const { SubnetType } = require('aws-cdk-lib/aws-ec2');
const { VpcEnvComponent } = require('@orange-stack/vpc-env-component');

class MyStack extends Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    const vpcEnvComponent = new VpcEnvComponent(this, 'MyEcs', {
      subnetsIds: [
        'subnet-xxxxxxxxxxxxxxxxx',
        'subnet-xxxxxxxxxxxxxxxxx',
        'subnet-xxxxxxxxxxxxxxxxx',
      ],
      subnetsType: SubnetType.PRIVATE_ISOLATED,
      vpcId: 'vpc-xxxxxxxxxxxxxxxxx',
    });
  }
}

module.exports = { MyStack }

Python

Not yet supported.

TypeScript

Install the dependency:

npm install --save @orange-stack/vpc-env-component

Import the construct into your project, for example:

import { Stack, StackProps } from 'aws-cdk-lib';
import { SubnetType } from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
import { VpcEnvComponent } from '@orange-stack/vpc-env-component';

export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const vpcEnvComponent = new VpcEnvComponent(this, 'MyEcs', {
      subnetsIds: [
        'subnet-xxxxxxxxxxxxxxxxx',
        'subnet-xxxxxxxxxxxxxxxxx',
        'subnet-xxxxxxxxxxxxxxxxx',
      ],
      subnetsType: SubnetType.PRIVATE_ISOLATED,
      vpcId: 'vpc-xxxxxxxxxxxxxxxxx',
    });
  }
}

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

Properties

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

Development

Prerequisites

Setup

cd vpc-env-jsii-component
npm install

You are done! Happy coding!

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.6
    0
    • latest

Version History

Package Sidebar

Install

npm i @orange-stack/vpc-env-component

Weekly Downloads

0

Version

0.1.6

License

MIT

Unpacked Size

976 kB

Total Files

15

Last publish

Collaborators

  • orange.stack