Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

AWS CDK Constructs Library for AWS EC2 like aws-ecs-parrens .

License

Notifications You must be signed in to change notification settings

cdk-constructs-zone/super-ec2

Repository files navigation

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

About

AWS CDK Constructs Library for AWS EC2 like aws-ecs-parrens .

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors