AWS CDK ACMPCA v1 Constructs

1.204.0 · active · verified Fri Apr 17

The `aws-cdk-aws-acmpca` library provides AWS Cloud Development Kit (CDK) constructs for provisioning and managing AWS Certificate Manager Private Certificate Authority (ACMPCA) resources. This specific package is part of the AWS CDK v1 ecosystem, currently at version `1.204.0`. AWS CDK typically follows a rapid release cadence, aligning with new AWS service features and bug fixes, though major development is now focused on CDK v2.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define a basic Root Certificate Authority (CA) using the `aws-cdk-aws-acmpca` v1 constructs. It sets up the necessary properties for a CA. To deploy this, ensure you have the AWS CDK CLI installed globally (`npm install -g aws-cdk`) and your AWS credentials configured, then run `cdk deploy`.

import os
from aws_cdk import core as cdk
from aws_cdk import aws_acmpca as acmpca

class MyAcmpcaStack(cdk.Stack):
    def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Example: Create a Root Certificate Authority
        # Note: A CA created this way needs to be activated manually
        # by issuing a self-signed certificate and importing it.
        # This construct only provisions the ACMPCA resource.
        acmpca.CertificateAuthority(self, "MyRootCA",
            certificate_authority_name="MyRootCA",
            type=acmpca.CertificateAuthorityType.ROOT,
            key_algorithm=acmpca.KeyAlgorithm.RSA_2048,
            signing_algorithm=acmpca.SigningAlgorithm.SHA256_WITH_RSA,
            subject=acmpca.CfnCertificateAuthority.SubjectProperty(
                country="US",
                state="WA",
                locality="Seattle",
                organization="MyOrg",
                organizational_unit="IT",
                common_name="MyRootCA",
            ),
            # For production, consider enabling S3 bucket for CRLs/audit reports:
            # revocation_configuration=acmpca.CfnCertificateAuthority.RevocationConfigurationProperty(
            #    crl_configuration=acmpca.CfnCertificateAuthority.CrlConfigurationProperty(
            #        enabled=True,
            #        custom_cname="crl.myorg.com",
            #        expiration_in_days=7,
            #        s3_bucket_name="my-crl-bucket"
            #    )
            # )
        )

app = cdk.App()
MyAcmpcaStack(app, "MyAcmpcaStack",
    env=cdk.Environment(
        account=os.environ.get("CDK_DEFAULT_ACCOUNT", "123456789012"), # Replace with your AWS account ID
        region=os.environ.get("CDK_DEFAULT_REGION", "us-east-1") # ACMPCA not available in all regions
    )
)
app.synth()

view raw JSON →