Package Exports
- @cdk-constructs-zone/super-ec2
- @cdk-constructs-zone/super-ec2/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cdk-constructs-zone/super-ec2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Welcome to @cdk-constructs-zone/super-ec2
This repository template helps you create EC2 .
Sample
Jenkins
- Simplest deployment: It would creat a VPC and ALB by default.
import * as cdk from '@aws-cdk/core';
import { JenkinsEC2, ELBtype } from '@cdk-constructs-zone/super-ec2';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'demo');
const jks = new JenkinsEC2(stack, 'superJks', {});
new cdk.CfnOutput(stack, 'loadbalancerDNS', {
value: jks.loadbalancer.loadBalancerDnsName,
});
new cdk.CfnOutput(stack, 'connect-to-instance', {
value: `aws ssm start-session --target ${jks.instance.instanceId}`,
});- Deploy Jenkins with self-defined VPC and NLB
const jks = new JenkinsEC2(stack, 'superJks', {
vpc: Vpc.fromLookup(stack, 'defaultVPC', { isDefault: true }),
loadbalancerType: ELBtype.NLB,
});- Deploy Jenkins with R53 records: If
acmis not given, it would create a certificate validated from DNS by default.
const jks = new JenkinsEC2(stack, 'superJks', {
vpc: Vpc.fromLookup(stack, 'defaultVPC', { isDefault: true }),
loadbalancerType: ELBtype.NLB,
domain: {
acm: Certificate.fromCertificateArn(stack, 'cert',
'arn:aws:xxx',
),
hostedZoneId: 'xxx',
zoneName: 'bbb.ccc',
recordName: 'aaa',
},
});Note: Jenkins initial admin password has been written to /home/ec2-user/jenkins-data/secrets/initialAdminPassword. You can access EC2 instance using ssm tool.
aws ssm start-session --target instance-id