@cdk-constructs-zone/super-ec2
TypeScript icon, indicating that this package has built-in type declarations

0.0.451 • Public • Published

NPM version PyPI version Release

Downloads npm PyPI

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 acm is 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

Readme

Keywords

Package Sidebar

Install

npm i @cdk-constructs-zone/super-ec2

Weekly Downloads

402

Version

0.0.451

License

Apache-2.0

Unpacked Size

139 kB

Total Files

20

Last publish

Collaborators

  • benkajaja