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/core';
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 { Construct } from '@aws-cdk/core';
import { Vpc } from '@aws-cdk/aws-ec2';
import { TempStack, TempStackProps } from '@cloudcomponents/cdk-temp-stack';
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 { Construct, Stack, StackProps, Duration } from '@aws-cdk/core';
import { TimeToLive } from '@cloudcomponents/cdk-temp-stack';
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-1.49.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f801bc09256e1a45f6e79a1d636025c8c68d1cb119dea9557b45458fa29f6a25 |
|
MD5 | c81a49622e506d8ff3c0abf6ed6d4da2 |
|
BLAKE2b-256 | bcdb8c3bc60975fd0918afe090173a937cd943f18fdac261b1ada707022767eb |
Close
Hashes for cloudcomponents.cdk_temp_stack-1.49.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73282f9bee816e22acf288ba2a08c1bf7bc83d4d5d7c67208eefd62fea904fa4 |
|
MD5 | 5bd7f8a4d8bd00a062f8548f3dcd78b0 |
|
BLAKE2b-256 | 6d6996b413b8bec2010685e8c72cd87927ad6d63ac4486a63bd72a3ca95990f0 |