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
# Example automatically generated from non-compiling source. May contain errors.
// 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
# Example automatically generated from non-compiling source. May contain errors.
// 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.48.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6bfc11f6c41357b433fe6e461bba0da4637c605c8f0f1fdfc8287c4fbe00e6f |
|
MD5 | a59d677ef2d4da7c87751adc9a3fe0ff |
|
BLAKE2b-256 | 4caf968b1ee4b7a0e3c5eda6b9a95290926498cbb8a6e2632c2eec264c485c91 |
Close
Hashes for cloudcomponents.cdk_temp_stack-1.48.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 591f50a8135341f6f614112966c8c8cc0dc21ea90f0481804531aed1fee1573b |
|
MD5 | 7192056583025b3b0b76102824f3758d |
|
BLAKE2b-256 | ecd784dca4bdb3586da96bff6ff3afc320c3850fd172b521cd27b083848cae34 |