A stack that destroys itself after a given time (ttl)
Project description
@cloudcomponents/cdk-temp-stack
A stack that destroys itself after a given time (ttl)
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-temp-stack
Python:
pip install cloudcomponents.cdk-temp-stack
How to use
// temp-infra-app.ts
#!/usr/bin/env node
import 'source-map-support/register';
import { App, Duration } from 'aws-cdk-lib';
import { TempInfraStack } from './temp-infra-stack';
const app = new App();
new TempInfraStack(app, 'TempInfraStack', {
env: {
region: process.env.DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT,
},
ttl: Duration.minutes(10),
});
// temp-infra-stack.ts
import { TempStack, TempStackProps } from '@cloudcomponents/cdk-temp-stack';
import { Vpc } from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
export class TempInfraStack extends TempStack {
constructor(scope: Construct, id: string, props: TempStackProps) {
super(scope, id, props);
new Vpc(this, 'VPC');
}
}
TimeToLive Construct
Alternatively, you can also add the TimeToLive construct to your stack
// your stack
import { TimeToLive } from '@cloudcomponents/cdk-temp-stack';
import { Stack, StackProps, Duration } from 'aws-cdk-lib';
import { Construct } from 'constructs';
export class YourStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
new TimeToLive(this, 'TimeToLive', {
ttl: Duration.minutes(10),
});
}
}
API Reference
See API.md.
Example
See more complete examples.
License
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
Close
Hashes for cloudcomponents.cdk-temp-stack-2.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3406712fba724faaa3926a427ac72b73448edc5e6799be409af3ba6c25a3e43 |
|
MD5 | c9ac620deed22aa2ac328a193cb5a058 |
|
BLAKE2b-256 | 9343afb66479421df6fa31f3b4a708ab38b3ea9671fbdf8538b7ec56d7390594 |
Close
Hashes for cloudcomponents.cdk_temp_stack-2.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8c52b8eb66ae1588a85005a08352326875904915876e52d52151bb95676788a |
|
MD5 | 6ddbe2725ed63141794dd59a34bf220c |
|
BLAKE2b-256 | 93eb13cebf9122bee40bff531d73e9860803716cd59325505eaec3d3843b86f8 |