Skip to content
Library to create an easy-to-use ECS cluster using AWS CDK
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/bin add x option Jun 16, 2019
src update Readme Jul 12, 2019
.gitignore add lockfile Jun 16, 2019
.npmignore init Jun 16, 2019
.travis.yml init Jun 16, 2019
LICENSE init Jun 16, 2019
NOTICE init Jun 16, 2019
README.md update Readme Jul 12, 2019
jest.config.js init Jun 16, 2019
package-lock.json Update dependency @types/node to v12.6.3 Jul 15, 2019
package.json Update dependency @types/node to v12.6.3 Jul 15, 2019
renovate.json init Jun 16, 2019
tsconfig.json init Jun 16, 2019
tslint.json init Jun 16, 2019

README.md

Cirrocumulus

Build Status

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, "UpdateFiles", {
  instanceRole,
  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.

You can’t perform that action at this time.