How to use the @pulumi/aws.efs function in @pulumi/aws

To help you get started, we’ve selected a few @pulumi/aws 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-awsx / nodejs / aws-infra / experimental / clusterFileSystem.ts View on Github external
securityGroup?: aws.ec2.SecurityGroup;

    /**
     * The subnets to mount the file system against.  If not provided, file system will be mounted
     * for every subnet in the cluster's network.
     */
    subnetIds?: pulumi.Input[];

    /**
     * Path to mount file system at when a cluster is connected to an autoscaling group.  If not
     * provided, the default mountPath will be "/mnt/efs"
     */
    mountPath?: pulumi.Input;
}>;

export class ClusterFileSystem extends aws.efs.FileSystem {
    public readonly cluster: module.Cluster;
    public readonly securityGroup: aws.ec2.SecurityGroup;
    public readonly mountTargets: aws.efs.MountTarget[];
    public readonly mountPath: pulumi.Output;

    constructor(name: string, cluster: module.Cluster,
                args: ClusterFileSystemArgs = {}, opts?: pulumi.CustomResourceOptions) {
        super(name, {
            ...args,
        }, opts);

        this.cluster = cluster;
        this.mountTargets = [];
        this.mountPath = pulumi.output(args.mountPath).apply(p => p || "/mnt/efs");

        // If requested, add EFS file system and mount targets in each subnet.
github pulumi / pulumi-aws / examples / delete_before_create / mount_target / step3 / index.ts View on Github external
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { getLinuxAMI } from "./linuxAmi";

const vpc = new aws.ec2.Vpc("vpc", {
    cidrBlock: "10.0.0.0/16",
});

const subnet = new aws.ec2.Subnet("subnet", {
    cidrBlock: "10.0.3.0/24", // <- changing the subnet cidrBlock triggers replacement
    vpcId: vpc.id,            //    which triggers the DBR replacement of MountTarget
                              //    this time, though, the instance is deleted and not replaced later
});

const fs = new aws.efs.FileSystem("fs");
const mountTarget = new aws.efs.MountTarget("mt", {
    fileSystemId: fs.id,
    subnetId: subnet.id,
});

export const dns = mountTarget.dnsName;
github pulumi / pulumi-awsx / nodejs / aws-infra / experimental / clusterFileSystem.ts View on Github external
constructor(name: string,
                args: ClusterFileSystemArgs,
                opts: pulumi.CustomResourceOptions = {}) {
        super("aws-infra:x:ClusterFileSystem", name, {}, opts);

        const parentOpts = { parent: this };

        this.cluster = args.cluster;
        this.fileSystem = new aws.efs.FileSystem(name, args, parentOpts);
        this.id = this.fileSystem.id;

        this.mountTargets = [];
        this.mountPath = utils.ifUndefined(args.mountPath, "/mnt/efs");

        // If requested, add EFS file system and mount targets in each subnet.

        const efsSecurityGroupName = `${name}-fs`;
        this.securityGroups = args.securityGroups || [new aws.ec2.SecurityGroup(efsSecurityGroupName, {
            vpcId: this.cluster.vpc.id,
            ingress: [
                // Allow NFS traffic from the instance security group
                {
                    securityGroups: this.cluster.securityGroups.map(g => g.id),
                    protocol: "TCP",
                    fromPort: 2049,
github pulumi / pulumi-awsx / nodejs / aws-infra / experimental / clusterFileSystem.ts View on Github external
ingress: [
                // Allow NFS traffic from the instance security group
                {
                    securityGroups: [ cluster.instanceSecurityGroup.id ],
                    protocol: "TCP",
                    fromPort: 2049,
                    toPort: 2049,
                },
            ],
            tags: { Name: efsSecurityGroupName },
        }, parentOpts);

        const subnetIds = args.subnetIds || cluster.network.subnetIds;
        for (let i = 0; i < subnetIds.length; i++) {
            const subnetId = subnetIds[i];
            this.mountTargets.push(new aws.efs.MountTarget(`${name}-${i}`, {
                fileSystemId: this.id,
                subnetId: subnetId,
                securityGroups: [ this.securityGroup.id ],
            }, parentOpts));
        }
    }
github pulumi / pulumi-aws / examples / delete_before_create / mount_target / step3 / index.ts View on Github external
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { getLinuxAMI } from "./linuxAmi";

const vpc = new aws.ec2.Vpc("vpc", {
    cidrBlock: "10.0.0.0/16",
});

const subnet = new aws.ec2.Subnet("subnet", {
    cidrBlock: "10.0.3.0/24", // <- changing the subnet cidrBlock triggers replacement
    vpcId: vpc.id,            //    which triggers the DBR replacement of MountTarget
                              //    this time, though, the instance is deleted and not replaced later
});

const fs = new aws.efs.FileSystem("fs");
const mountTarget = new aws.efs.MountTarget("mt", {
    fileSystemId: fs.id,
    subnetId: subnet.id,
});

export const dns = mountTarget.dnsName;
github pulumi / pulumi-aws / examples / delete_before_create / mount_target / step2 / index.ts View on Github external
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { getLinuxAMI } from "./linuxAmi";

const vpc = new aws.ec2.Vpc("vpc", {
    cidrBlock: "10.0.0.0/16",
});

const subnet = new aws.ec2.Subnet("subnet", {
    cidrBlock: "10.0.2.0/24", // <- changing the subnet cidrBlock triggers replacement
    vpcId: vpc.id,            //    which triggers the DBR replacement of MountTarget
});

const fs = new aws.efs.FileSystem("fs");
const mountTarget = new aws.efs.MountTarget("mt", {
    fileSystemId: fs.id,
    subnetId: subnet.id,
});

const size = aws.ec2.InstanceTypes.T2_Micro;
const instance = new aws.ec2.Instance("dummy-instance", {
    userData: pulumi.interpolate `#!/bin/bash
echo ${mountTarget.dnsName}`,
    ami: getLinuxAMI(size),
    instanceType: size,
});

export const dnsName = instance.publicDns;
github pulumi / pulumi-cloud / aws / infrastructure / cluster.ts View on Github external
toPort: 65535,
                    protocol: "TCP",
                    cidrBlocks: [ "0.0.0.0/0" ],
                },
            ],
            egress: [ ALL ],  // See TerraformEgressNote
            tags: {
                Name: name,
            },
        });
        this.securityGroupId = instanceSecurityGroup.id;

        // If requested, add EFS file system and mount targets in each subnet.
        let filesystem: aws.efs.FileSystem | undefined;
        if (args.addEFS) {
            filesystem = new aws.efs.FileSystem(name);
            const efsSecurityGroupName = `${name}-fs`;
            const efsSecurityGroup = new aws.ec2.SecurityGroup(efsSecurityGroupName, {
                vpcId: args.network.vpcId,
                ingress: [
                    // Allow NFS traffic from the instance security group
                    {
                        securityGroups: [ instanceSecurityGroup.id ],
                        protocol: "TCP",
                        fromPort: 2049,
                        toPort: 2049,
                    },
                ],
                tags: {
                    Name: efsSecurityGroupName,
                },
            });
github pulumi / pulumi-awsx / nodejs / aws-infra / experimental / clusterFileSystem.ts View on Github external
ingress: [
                // Allow NFS traffic from the instance security group
                {
                    securityGroups: this.cluster.securityGroups.map(g => g.id),
                    protocol: "TCP",
                    fromPort: 2049,
                    toPort: 2049,
                },
            ],
            tags: { Name: efsSecurityGroupName },
        }, parentOpts)];

        const subnetIds = args.subnetIds || this.cluster.vpc.publicSubnetIds;
        for (let i = 0; i < subnetIds.length; i++) {
            const subnetId = subnetIds[i];
            this.mountTargets.push(new aws.efs.MountTarget(`${name}-${i}`, {
                fileSystemId: this.fileSystem.id,
                subnetId: subnetId,
                securityGroups: this.securityGroups.map(g => g.id),
            }, parentOpts));
        }

        this.registerOutputs();
    }
}
github pulumi / pulumi-aws / examples / delete_before_create / mount_target / step1 / index.ts View on Github external
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { getLinuxAMI } from "./linuxAmi";

const vpc = new aws.ec2.Vpc("vpc", {
    cidrBlock: "10.0.0.0/16",
});

const subnet = new aws.ec2.Subnet("subnet", {
    cidrBlock: "10.0.1.0/24",
    vpcId: vpc.id,
});

const fs = new aws.efs.FileSystem("fs");
const mountTarget = new aws.efs.MountTarget("mt", {
    fileSystemId: fs.id,
    subnetId: subnet.id,
});

const size = aws.ec2.InstanceTypes.T2_Micro;
const instance = new aws.ec2.Instance("dummy-instance", {
    userData: pulumi.interpolate `#!/bin/bash
echo ${mountTarget.dnsName}`,
    ami: getLinuxAMI(size),
    instanceType: size,
});

export const dnsName = instance.publicDns;
github pulumi / pulumi-aws / examples / delete_before_create / mount_target / step1 / index.ts View on Github external
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { getLinuxAMI } from "./linuxAmi";

const vpc = new aws.ec2.Vpc("vpc", {
    cidrBlock: "10.0.0.0/16",
});

const subnet = new aws.ec2.Subnet("subnet", {
    cidrBlock: "10.0.1.0/24",
    vpcId: vpc.id,
});

const fs = new aws.efs.FileSystem("fs");
const mountTarget = new aws.efs.MountTarget("mt", {
    fileSystemId: fs.id,
    subnetId: subnet.id,
});

const size = aws.ec2.InstanceTypes.T2_Micro;
const instance = new aws.ec2.Instance("dummy-instance", {
    userData: pulumi.interpolate `#!/bin/bash
echo ${mountTarget.dnsName}`,
    ami: getLinuxAMI(size),
    instanceType: size,
});

export const dnsName = instance.publicDns;