Skip to content

Commit 9553cf9

Browse files
committed
init
1 parent 952c749 commit 9553cf9

File tree

6 files changed

+6654
-8
lines changed

6 files changed

+6654
-8
lines changed

bin/mcdemo-cdk.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/env node
2+
3+
const envDemo = { account: '741142690061', region: 'us-east-1' };
4+
5+
6+
27
import 'source-map-support/register';
3-
import cdk = require('@aws-cdk/core');
8+
import cdk = require('@aws-cdk/core');
49
import { McdemoCdkStack } from '../lib/mcdemo-cdk-stack';
510

611
const app = new cdk.App();
7-
new McdemoCdkStack(app, 'McdemoCdkStack');
12+
new McdemoCdkStack(app, 'McdemoCdkStack', { env: envDemo });

cdk.context.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"@aws-cdk/core:enableStackNameDuplicates": "true",
3+
"aws-cdk:enableDiffNoFail": "true",
4+
"availability-zones:account=741142690061:region=us-east-1": [
5+
"us-east-1a",
6+
"us-east-1b",
7+
"us-east-1c",
8+
"us-east-1d",
9+
"us-east-1e",
10+
"us-east-1f"
11+
]
12+
}

cdk.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"app": "npx ts-node bin/mcdemo-cdk.ts",
3-
"context": {
4-
"@aws-cdk/core:enableStackNameDuplicates": "true",
5-
"aws-cdk:enableDiffNoFail": "true"
6-
}
2+
"app": "npx ts-node bin/mcdemo-cdk.ts"
73
}

lib/mcdemo-cdk-stack.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,38 @@
11
import cdk = require('@aws-cdk/core');
2+
import ec2 = require('@aws-cdk/aws-ec2');
3+
import autoscaling = require('@aws-cdk/aws-autoscaling');
4+
import { BastionHostLinux } from '@aws-cdk/aws-ec2';
5+
26

37
export class McdemoCdkStack extends cdk.Stack {
48
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
59
super(scope, id, props);
610

7-
// The code that defines your stack goes here
11+
// The code that defines your stack goes here
12+
13+
const pemkey = 'mcdemo.pem';
14+
15+
const vpc = new ec2.Vpc(this, 'VPC');
16+
17+
// TODO: add tgw when Multicast is supported in CFN/CDK
18+
19+
const bastionhost = new ec2.BastionHostLinux(this, 'BastionHost', {vpc: vpc});
20+
21+
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
22+
vpc,
23+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE),
24+
machineImage: new ec2.AmazonLinuxImage(),
25+
desiredCapacity: 3,
26+
keyName: pemkey,
27+
});
28+
29+
asg.connections.allowFromAnyIpv4;
30+
asg.userData.addCommands(
31+
'#!/bin/bash -xe',
32+
'yum -y update',
33+
'yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
34+
'yum -y install iperf'
35+
);
36+
837
}
938
}

0 commit comments

Comments
 (0)