How to use the @pulumi/awsx.Network function in @pulumi/awsx

To help you get started, we’ve selected a few @pulumi/awsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / pulumi-cloud / aws / shared.ts View on Github external
export function getOrCreateNetwork(): CloudNetwork {
    if (!network) {
        if (!config.externalVpcId) {
            if (config.usePrivateNetwork) {
                // Create a new VPC for this private network.
                network = new awsx.Network(createNameWithStackInfo("global"), {
                    usePrivateSubnets: config.usePrivateNetwork,
                    numberOfAvailabilityZones: config.ecsAutoCluster ? config.ecsAutoClusterNumberOfAZs : undefined,
                });
            } else {
                // Use the default VPC.
                network = awsx.Network.getDefault();
            }
        } else /* config.externalVpcId */ {
            if (!config.externalSubnets || !config.externalSecurityGroups || !config.externalPublicSubnets) {
                throw new RunError(
                    "If providing 'externalVpcId', must provide 'externalSubnets', " +
                    "'externalPublicSubnets' and 'externalSecurityGroups'");
            }
            // Use an exsting VPC for this private network
            network = awsx.Network.fromVpc("external-vpc", {
                vpcId: config.externalVpcId,
github pulumi / pulumi-awsx / nodejs / examples / cluster / index.ts View on Github external
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";
import { Output } from "@pulumi/pulumi";

const prefix = "infratest";
const numAvailabilityZones = 2;
const instanceType = "m5.large";

let network = new awsx.Network(`${prefix}-net`, {
    numberOfAvailabilityZones: numAvailabilityZones, // Create subnets in many AZs
    usePrivateSubnets: true,                         // Run compute inside private subnets in each AZ
});

const cluster = new awsx.Cluster(prefix, {
    minSize: numAvailabilityZones, // Ensure we keep at least one VM per AZ
    network: network,              // The network to provision this cluster inside
    addEFS: false,                 // Don't provision an EFS file system for this cluster
    instanceType: instanceType,    // Use a configured value for cluster VM sizes
});

// Export details of the network and cluster
export let vpcId = network.vpcId;
export let privateSubnetIds = pulumi.all(network.subnetIds).apply(ids => ids.join(","));
export let publicSubnetIds = pulumi.all(network.publicSubnetIds).apply(ids => ids.join(","));
export let securityGroupIds = pulumi.all(network.securityGroupIds).apply(ids => ids.join(","));
github pulumi / examples / aws-ts-eks-hello-world / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";

const name = "helloworld";

// Create an EKS cluster with non-default configuration
const vpc = new awsx.Network("vpc", { usePrivateSubnets: false });
const cluster = new eks.Cluster(name, {
    vpcId: vpc.vpcId,
    subnetIds: vpc.subnetIds,
    desiredCapacity: 2,
    minSize: 1,
    maxSize: 2,
    storageClasses: "gp2",
    deployDashboard: false,
});

// Export the clusters' kubeconfig.
export const kubeconfig = cluster.kubeconfig;

// Create a Kubernetes Namespace
const ns = new k8s.core.v1.Namespace(name, {}, { provider: cluster.provider });
github pulumi / pulumi-eks / nodejs / eks / examples / private-workers / index.ts View on Github external
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";

const name = "example-private-subnets-cluster";

// Create a VPC that uses private subnets.
const network = new awsx.Network(name, {
    numberOfAvailabilityZones: 2,
    usePrivateSubnets: true,
});

// Create a cluster with the desired specs, that does not auto assign a public
// IP to its workers.
const cluster = new eks.Cluster(name, {
    deployDashboard: false,
    desiredCapacity: 1,
    maxSize: 1,
    vpcId: network.vpcId,
    subnetIds: network.subnetIds,
    nodeAssociatePublicIpAddress: false,
});

export const kubeconfig = cluster.kubeconfig;
github pulumi / examples / aws-ts-eks / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";

// Create a VPC for our cluster.
const vpc = new awsx.Network("vpc");

// Create the EKS cluster itself, including a "gp2"-backed StorageClass and a deployment of the Kubernetes dashboard.
const cluster = new eks.Cluster("cluster", {
    vpcId: vpc.vpcId,
    subnetIds: vpc.subnetIds,
    instanceType: "t2.medium",
    desiredCapacity: 2,
    minSize: 1,
    maxSize: 2,
    storageClasses: "gp2",
    deployDashboard: true,
});

// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;

@pulumi/awsx

[![Actions Status](https://github.com/pulumi/pulumi-awsx/workflows/master/badge.svg)](https://github.com/pulumi/pulumi-awsx/actions) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https://badge.fur

Apache-2.0
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis