Skip to main content

Domain with certificate

Project description



Alma CDK Domain

npm i -D @alma-cdk/domain

Simplifies creation of subdomain with a TLS certificate and configuration with services like AWS CloudFront.



🚧   Project Stability

experimental

This construct is still versioned with v0 major version and breaking changes might be introduced if necessary (without a major version bump), though we aim to keep the API as stable as possible (even within v0 development). We aim to publish v1.0.0 soon and after that breaking changes will be introduced via major version bumps.


Getting Started

import { Domain } from '@alma-cdk/domain';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
const domain = new Domain(this, 'Domain', {
  zone: 'example.com', // retrieve the zone via lookup, or provide IHostedZone
  subdomain: 'foobar', // optional subdomain
});

const distribution = new cloudfront.Distribution(this, 'Distribution', {
  /* other cloudfront configuration values removed for brevity */

  certificate: domain.certificate, // reference to created ICertificate
  domainNames: [domain.fqdn], // foobar.example.com
  enableIpv6: domain.enableIpv6, // true by default  set enableIpv6 prop to false during new Domain()
})

// assign CloudFront distribution to given fqdn with A + AAAA records
domain.addTarget(new targets.CloudFrontTarget(distribution))

CloudFront helper

Instead of assigning certificate, domainNames and enableIpv6 properties individually, you may choose to use the one-liner helper utility method configureCloudFront() to set all three values at once – don't forget to use ... object spread syntax:

const distribution = new cloudfront.Distribution(this, 'Distribution', {
  /* other cloudfront configuration values removed for brevity */

  // one-liner to configure certificate, domainNames and IPv6 support
  ...domain.configureCloudFront(),
})

// assign CloudFront distribution to given fqdn with A + AAAA records
domain.addTarget(new targets.CloudFrontTarget(distribution))

Note: The returned domain names configuration is domainNames: [domain.fqdn], meaning this only works in scenarios where your CloudFront distribution has only single domain name.

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

alma-cdk.domain-0.0.13.tar.gz (70.7 kB view details)

Uploaded Source

Built Distribution

alma_cdk.domain-0.0.13-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file alma-cdk.domain-0.0.13.tar.gz.

File metadata

  • Download URL: alma-cdk.domain-0.0.13.tar.gz
  • Upload date:
  • Size: 70.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for alma-cdk.domain-0.0.13.tar.gz
Algorithm Hash digest
SHA256 b4b48b97aa421943771226dfb0271285f1f0742e41e7b1b8f7fcaff4d4099816
MD5 578e66054d02dcffb93db1aa68a113d2
BLAKE2b-256 0ffb4effb0baa12bfb756a9f312e2efd4024fe4ef0572a7562a2b9ad710cc326

See more details on using hashes here.

File details

Details for the file alma_cdk.domain-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for alma_cdk.domain-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 e7035b3bb3f96bd777d3503923b1d8b7bfa3ffb595dce22605b5b8cdaadc9926
MD5 0017c01d9b19bec10ab5fd531c9a7e67
BLAKE2b-256 d3b5420394a46cb6eea44e9491b32077d1b2cdbc7550a8356ec273d5aa1162ce

See more details on using hashes here.

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