Skip to main content

CDK Construct for managing EC2 key pairs

Project description

CDK SSM Document

Source Docs npm version PyPI version NuGet version GitHub

AWS CDK L3 construct for managing EC2 Key Pairs.

CloudFormation does not directly support creation of EC2 Key Pairs. This construct provides an easy interface for creating Key Pairs through a custom CloudFormation resource. The private key is stored in AWS Secrets Manager.

Usage

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.core as cdk
from cdk_ec2_key_pair import KeyPair

# Create the Private Key
key = KeyPair(self, "A-Key-Pair",
    name="a-key-pair",
    description="This is a Key Pair"
)

# Grant read access to a role or user
key.grant_read(some_role)

The private key will be stored in AWS Secrets Manager. The secret name is prefixed with ec2-private-key/, so in this example it will be saved as ec2-private-key/a-key-pair.

Roadmap

  • Automated Tests
  • Tagging support in a more standard way

Project details


Download files

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

Source Distribution

cdk-ec2-key-pair-0.2.1.tar.gz (26.1 kB view hashes)

Uploaded Source

Built Distribution

cdk_ec2_key_pair-0.2.1-py3-none-any.whl (25.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page