Skip to main content

A construct lib for AWS CDK EC2

Project description

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.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.core as cdk
from cdk_constructs_zone.super_ec2 import JenkinsEC2, ELBtype

app = cdk.App()

stack = cdk.Stack(app, "demo")

jks = JenkinsEC2(stack, "superJks")

cdk.CfnOutput(stack, "loadbalancerDNS",
    value=jks.loadbalancer.load_balancer_dns_name
)
cdk.CfnOutput(stack, "connect-to-instance",
    value=f"aws ssm start-session --target {jks.instance.instanceId}"
)
  • Deploy Jenkins with self-defined VPC and NLB
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
jks = JenkinsEC2(stack, "superJks",
    vpc=Vpc.from_lookup(stack, "defaultVPC", is_default=True),
    loadbalancer_type=ELBtype.NLB
)
  • Deploy Jenkins with R53 records: If acm is not given, it would create a certificate validated from DNS by default.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
jks = JenkinsEC2(stack, "superJks",
    vpc=Vpc.from_lookup(stack, "defaultVPC", is_default=True),
    loadbalancer_type=ELBtype.NLB,
    domain={
        "acm": Certificate.from_certificate_arn(stack, "cert", "arn:aws:xxx"),
        "hosted_zone_id": "xxx",
        "zone_name": "bbb.ccc",
        "record_name": "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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for super-ec2, version 0.0.175
Filename, size File type Python version Upload date Hashes
Filename, size super_ec2-0.0.175-py3-none-any.whl (37.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size super-ec2-0.0.175.tar.gz (38.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page