Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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" },
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,
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,
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 &",