Skip to main content

The CDK Construct Library for AWS::CertificateManager

Project description

AWS Certificate Manager Construct Library

---

cfn-resources: Stable

cdk-constructs: Stable


AWS Certificate Manager (ACM) handles the complexity of creating, storing, and renewing public and private SSL/TLS X.509 certificates and keys that protect your AWS websites and applications. ACM certificates can secure singular domain names, multiple specific domain names, wildcard domains, or combinations of these. ACM wildcard certificates can protect an unlimited number of subdomains.

This package provides Constructs for provisioning and referencing ACM certificates which can be used with CloudFront and ELB.

After requesting a certificate, you will need to prove that you own the domain in question before the certificate will be granted. The CloudFormation deployment will wait until this verification process has been completed.

Because of this wait time, when using manual validation methods, it's better to provision your certificates either in a separate stack from your main service, or provision them manually and import them into your CDK application.

Note: There is a limit on total number of ACM certificates that can be requested on an account and region within a year. The default limit is 2000, but this limit may be (much) lower on new AWS accounts. See https://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html for more information.

DNS validation

DNS validation is the preferred method to validate domain ownership, as it has a number of advantages over email validation. See also Validate with DNS in the AWS Certificate Manager User Guide.

If Amazon Route 53 is your DNS provider for the requested domain, the DNS record can be created automatically:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.aws_certificatemanager as acm
import aws_cdk.aws_route53 as route53

my_hosted_zone = route53.HostedZone(self, "HostedZone",
    zone_name="example.com"
)
acm.Certificate(self, "Certificate",
    domain_name="hello.example.com",
    validation=acm.CertificateValidation.from_dns(my_hosted_zone)
)

If Route 53 is not your DNS provider, the DNS records must be added manually and the stack will not complete creating until the records are added.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
acm.Certificate(self, "Certificate",
    domain_name="hello.example.com",
    validation=acm.CertificateValidation.from_dns()
)

When working with multiple domains, use the CertificateValidation.fromDnsMultiZone():

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
example_com = route53.HostedZone(self, "ExampleCom",
    zone_name="example.com"
)
example_net = route53.HostedZone(self, "ExampleNet",
    zone_name="example.net"
)

cert = acm.Certificate(self, "Certificate",
    domain_name="test.example.com",
    subject_alternative_names=["cool.example.com", "test.example.net"],
    validation=acm.CertificateValidation.from_dns_multi_zone(
        test.example.com=example_com,
        cool.example.com=example_com,
        test.example.net=example_net
    )
)

Email validation

Email-validated certificates (the default) are validated by receiving an email on one of a number of predefined domains and following the instructions in the email.

See Validate with Email in the AWS Certificate Manager User Guide.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
acm.Certificate(self, "Certificate",
    domain_name="hello.example.com",
    validation=acm.CertificateValidation.from_email()
)

Cross-region Certificates

ACM certificates that are used with CloudFront -- or higher-level constructs which rely on CloudFront -- must be in the us-east-1 region. The DnsValidatedCertificate construct exists to facilitate creating these certificates cross-region. This resource can only be used with Route53-based DNS validation.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
acm.DnsValidatedCertificate(self, "CrossRegionCertificate",
    domain_name="hello.example.com",
    hosted_zone=my_hosted_zone,
    region="us-east-1"
)

Importing

If you want to import an existing certificate, you can do so from its ARN:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
arn = "arn:aws:..."
certificate = Certificate.from_certificate_arn(self, "Certificate", arn)

Sharing between Stacks

To share the certificate between stacks in the same CDK application, simply pass the Certificate object between the stacks.

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.

Source Distribution

aws-cdk.aws-certificatemanager-1.95.2.tar.gz (242.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_cdk.aws_certificatemanager-1.95.2-py3-none-any.whl (245.1 kB view details)

Uploaded Python 3

File details

Details for the file aws-cdk.aws-certificatemanager-1.95.2.tar.gz.

File metadata

  • Download URL: aws-cdk.aws-certificatemanager-1.95.2.tar.gz
  • Upload date:
  • Size: 242.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.5

File hashes

Hashes for aws-cdk.aws-certificatemanager-1.95.2.tar.gz
Algorithm Hash digest
SHA256 7639cd1d71b00610543c781e1cde2eb156b7160b67f9a03bf65b22314b8a2f86
MD5 862df8625ce96eae1ae2c0db9ef11131
BLAKE2b-256 25587903261121d5b261cee4589bd1e7541c0a10c71b44e42a6568580f8fdb20

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_certificatemanager-1.95.2-py3-none-any.whl.

File metadata

  • Download URL: aws_cdk.aws_certificatemanager-1.95.2-py3-none-any.whl
  • Upload date:
  • Size: 245.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.5

File hashes

Hashes for aws_cdk.aws_certificatemanager-1.95.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d0cac808507d0c8bbaddf524fb201135344206deda22e7e137720a058b371aa
MD5 118d73672ed9112fdfa5d9ee8cec1a35
BLAKE2b-256 7277d97ed4aca7b86bfc9a6448d3da350731727307b7039df53ec45097f5aa21

See more details on using hashes here.

Supported by

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