Create Cron Job Via Lambda, to update certificate and put it to S3 Bucket.
Project description
cdk-certbot-dns-route53
cdk-certbot-dns-route53 is a CDK construct library that allows you to create Certbot Lambda Function on AWS with CDK, and setting schedule cron job to renew certificate to store on S3 Bucket.
Install
Use the npm dist tag to opt in CDKv1 or CDKv2:
// for CDKv2
npm install cdk-certbot-dns-route53
or
npm install cdk-certbot-dns-route53@latest
// for CDKv1
npm install cdk-certbot-dns-route53@cdkv1
💡💡💡 please click here, if you are using aws-cdk v1.x.x version.💡💡💡
import * as r53 from 'aws-cdk-lib/aws-route53';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as cdk from 'aws-cdk-lib';
import { CertbotDnsRoute53Job } from 'cdk-certbot-dns-route53';
const devEnv = {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
};
const app = new cdk.App();
const stack = new cdk.Stack(app, 'lambda-certbot-dev', { env: devEnv });
new CertbotDnsRoute53Job(stack, 'Demo', {
certbotOptions: {
domainName: '*.example.com',
email: 'user@example.com',
},
zone: r53.HostedZone.fromHostedZoneAttributes(stack, 'myZone', {
zoneName: 'example.com',
hostedZoneId: 'mockId',
}),
destinationBucket: s3.Bucket.fromBucketName(stack, 'myBucket', 'mybucket'),
});
You can define Lambda Image Architecture now. 2022/04/19
import * as r53 from 'aws-cdk-lib/aws-route53';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as cdk from 'aws-cdk-lib';
import { CertbotDnsRoute53Job } from 'cdk-certbot-dns-route53';
const mockApp = new cdk.App();
const stack = new cdk.Stack(mockApp, 'teststack', { env: devEnv });
const bucket = new s3.Bucket(stack, 'testingBucket');
const zone = r53.HostedZone.fromHostedZoneAttributes(stack, 'zone', {
zoneName: mock.zoneName, hostedZoneId: mock.zoneId,
});
new CertbotDnsRoute53Job(stack, 'Testtask', {
certbotOptions: {
domainName: 'example.com',
email: 'user@example.com',
customPrefixDirectory: '/',
},
zone,
destinationBucket: bucket,
schedule: events.Schedule.cron({ month: '2' }),
architecture: lambda.Architecture.ARM_64, // <- like this way.
});
Example: Invoke Lambda Function log.
Example: Renew certificate to store on S3 Bucket
Support Python Lambda Runtime. 2023/12/17
Support enabled Lambda Function Url.
import * as r53 from 'aws-cdk-lib/aws-route53';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as cdk from 'aws-cdk-lib';
import { CertbotDnsRoute53JobPython } from 'cdk-certbot-dns-route53';
const mockApp = new cdk.App();
const stack = new cdk.Stack(mockApp, 'teststack', { env: devEnv });
const bucket = new s3.Bucket(stack, 'testingBucket');
const zone = r53.HostedZone.fromHostedZoneAttributes(stack, 'zone', {
zoneName: mock.zoneName, hostedZoneId: mock.zoneId,
});
new CertbotDnsRoute53JobPython(stack, 'Testtask', {
certbotOptions: {
domainName: 'example.com',
email: 'user@example.com',
customPrefixDirectory: '/',
},
zone,
destinationBucket: bucket,
schedule: events.Schedule.cron({ month: '2' }),
enabledLambdaFunctionUrl: true,
});
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
Built Distribution
File details
Details for the file cdk_certbot_dns_route53-2.4.308.tar.gz
.
File metadata
- Download URL: cdk_certbot_dns_route53-2.4.308.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099cead5b213b239455ff73753f25c954ec7110df3cc1167f0e97c2f24c202d0 |
|
MD5 | 7842fc3655527699bba1afac789052ac |
|
BLAKE2b-256 | 6714f4fb5532624ec05e59a10a387c0c33df6a84f82ac9dd529b044ded144eb7 |
File details
Details for the file cdk_certbot_dns_route53-2.4.308-py3-none-any.whl
.
File metadata
- Download URL: cdk_certbot_dns_route53-2.4.308-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9da44d346808e5c5f2eadcf7061f9101b3ee920144499d826cfb9a449b7a3340 |
|
MD5 | 39dae0009da358706eec3e43115a3a82 |
|
BLAKE2b-256 | 13c974771e369528a35a702da3e2907d84ff6ac57af7d8a0a0522da137a405c6 |