@aereal/cirrocumulus
TypeScript icon, indicating that this package has built-in type declarations

1.1.24 • Public • Published

Cirrocumulus

Build Status

Install

npm i -D @cohalz/cirrocumulus

Libraries

Ec2Cluster

  • A ECS cluster configuration such as userdata

DeployFiles

  • Deploy local files to all instances of the ECS cluster

Synopsis

import { SynthUtils } from "@aws-cdk/assert"
import { InstanceClass, InstanceSize, Vpc } from "@aws-cdk/aws-ec2"
import { Role } from "@aws-cdk/aws-iam"
import { Stack } from "@aws-cdk/core"
import { Ec2Cluster, DeployFiles, ScalingPlan } from '@cohalz/cirrocumulus'
import * as path from "path"

const stack = new Stack()
const vpc = new Vpc(stack, "VPC")

const ec2Cluster = new Ec2Cluster(stack, "Ec2Cluster", {
  instanceTypes: [new InstanceType("t3.medium")],
  vpc,
})

const deployFiles = new DeployFiles(stack, "DeployFiles", {
  source: path.join(process.cwd(), "examples/"),
  targets: [
    {
      key: "tag:ClusterName",
      values: [ec2Cluster.cluster.clusterName],
    },
  ],
})

const instanceRole = ec2Cluster.autoScalingGroup.node.findChild(
  "InstanceRole"
) as Role
instanceRole.addToPolicy(deployFiles.deployPolicy())

const ecsService = new ecsPatterns.LoadBalancedEc2Service(this, "Ec2Service", {
  cluster: ec2Cluster.cluster,
  memoryLimitMiB: 512,
  image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
})

new cdk.CfnOutput(this, 'LoadBalancerDNS', { value: ecsService.loadBalancer.loadBalancerDnsName })

License

cirrocumulus is distributed under the Apache License, Version 2.0.

See LICENSE and NOTICE for more information.

Readme

Keywords

Package Sidebar

Install

npm i @aereal/cirrocumulus

Weekly Downloads

1

Version

1.1.24

License

Apache-2.0

Unpacked Size

604 kB

Total Files

54

Last publish

Collaborators

  • aereal