How to use the @pulumi/awsx.lb 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 / examples / aws-ts-pulumi-miniflux / index.ts View on Github external
engine: "postgres",
    instanceClass: aws.rds.InstanceTypes.T3_Micro,
    allocatedStorage: 5,
    dbSubnetGroupName: subnetGroup.id,
    vpcSecurityGroupIds: cluster.securityGroups.map(g => g.id),
    name: dbName,
    username: dbUsername,
    password: dbPassword,
    skipFinalSnapshot: true,
});

// Assemble a connection string for the Miniflux service.
const connectionString = pulumi.interpolate `postgres://${dbUsername}:${dbPassword}@${db.endpoint}/miniflux?sslmode=disable`;

// Create an NetworkListener to forward HTTP traffic on port 8080.
const listener = new awsx.lb.NetworkListener("lb", { port: 8080 });

// Create a Fargate service consisting of just one container instance (since that's all we
// really need), passing it the cluster, DB connection and Pulumi config settings.
const service = new awsx.ecs.FargateService("service", {
    cluster,
    desiredCount: 1,
    taskDefinitionArgs: {
        containers: {
            service: {
                image: "miniflux/miniflux:latest",
                portMappings: [
                    listener,
                ],
                environment: [
                    { name: "DATABASE_URL", value: connectionString },
                    { name: "RUN_MIGRATIONS", value: "1" },
github ever-co / gauzy-pulumi / src / environments / demo / frontend.ts View on Github external
export const createFrontend = async (
	webappImage: awsx.ecs.Image,
	cluster: Cluster,
	apiBaseUrl: string
) => {
	// Create ALB (application load balancer), see https://www.pulumi.com/docs/guides/crosswalk/aws/elb
	const alb = new awsx.lb.ApplicationLoadBalancer('gauzy-webapp-demo', {
		name: 'gauzy-webapp-demo',
		securityGroups: cluster.securityGroups,
		external: true,
		enableHttp2: true,
		// this can be helpful to avoid accidentally deleting a long-lived, but auto-generated, load balancer URL.
		enableDeletionProtection: false
	});

	// This defines where requests will be forwarded to (e.g. in our case Fargate Services running and listening on port 4200)
	const webTarget = alb.createTargetGroup('gauzy-webapp-target-demo', {
		name: 'gauzy-webapp-target-demo',
		port: frontendPort,
		protocol: 'HTTP',
		healthCheck: {
			unhealthyThreshold: 10,
			timeout: 120,
github ever-co / gauzy-pulumi / src / environments / dev / frontend.ts View on Github external
export const createFrontend = async (
	webappImage: awsx.ecs.Image,
	cluster: Cluster,
	apiBaseUrl: string
) => {
	// Create ALB (application load balancer), see https://www.pulumi.com/docs/guides/crosswalk/aws/elb
	const alb = new awsx.lb.ApplicationLoadBalancer('gauzy-webapp-dev', {
		name: 'gauzy-webapp-dev',
		securityGroups: cluster.securityGroups,
		external: true,
		enableHttp2: true,
		// this can be helpful to avoid accidentally deleting a long-lived, but auto-generated, load balancer URL.
		enableDeletionProtection: false
	});

	// This defines where requests will be forwarded to (e.g. in our case Fargate Services running and listening on port 4200)
	const webTarget = alb.createTargetGroup('gauzy-webapp-target-dev', {
		name: 'gauzy-webapp-target-dev',
		port: frontendPort,
		protocol: 'HTTP',
		healthCheck: {
			unhealthyThreshold: 10,
			timeout: 120,
github pulumi / infrastructure-as-code-workshop / labs / aws / typescript / lab-02 / code / step4.ts View on Github external
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const ami = aws.getAmi({
    filters: [{ name: "name", values: ["amzn-ami-hvm-*-x86_64-ebs"] }],
    owners: [ "137112412989" ],
    mostRecent: true,
}).then(ami => ami.id);

const sg = new aws.ec2.SecurityGroup("web-secgrp", {
    ingress: [
        { protocol: "icmp", fromPort: 8, toPort: 0, cidrBlocks: ["0.0.0.0/0"] },
    ],
});

const alb = new awsx.lb.ApplicationLoadBalancer("web-traffic", {
    external: true,
    securityGroups: [ sg.id ],
});
const listener = alb.createListener("web-listener", { port: 80 });

export const ips: any[] = [];
export const hostnames: any[] = [];
for (const az of aws.getAvailabilityZones().names) {
    const server = new aws.ec2.Instance(`web-server-${az}`, {
        instanceType: "t2.micro",
        securityGroups: alb.securityGroups.map(sg => sg.securityGroup.name),
        ami: ami,
        availabilityZone: az,
        userData: "#!/bin/bash\n"+
            `echo 'Hello, World -- from ${az}!' > index.html\n` +
            "nohup python -m SimpleHTTPServer 80 &",

@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