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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f11f0ea70c732c3bee186aec1b0468e5c2975f258f6e5d2980d0dcaa0cb410 |
|
MD5 | f9d25b1c3ff36e660287c2ee3c0effbb |
|
BLAKE2b-256 | d55739049972be84be9bb79d391187bca610d9d3668f9af777129f27947915a6 |
Close
Hashes for cloudcomponents.cdk_temp_stack-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f58b731fd0b0a25a9039be3abe6bd783f063b03dd50593eeeafa44af8af6c0f2 |
|
MD5 | 6d084097871fd89228e560be4ff2a7c1 |
|
BLAKE2b-256 | 748603fe5244dbaffbe98e96450454e39bf1685eb926e2166bebf424706e8d3a |