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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloudcomponents.cdk-temp-stack-2.4.0.tar.gz.
File metadata
- Download URL: cloudcomponents.cdk-temp-stack-2.4.0.tar.gz
- Upload date:
- Size: 139.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb9e11cd02d5e2929c1b2126fc30cdb148090c930f13d203b0c543937fd04d9
|
|
| MD5 |
c55c8009de2bc7899a2c8b88def27871
|
|
| BLAKE2b-256 |
cb54e7ca9693a3b773eff243acadac36748d477b397c14c1802a437a4afc68e8
|
File details
Details for the file cloudcomponents.cdk_temp_stack-2.4.0-py3-none-any.whl.
File metadata
- Download URL: cloudcomponents.cdk_temp_stack-2.4.0-py3-none-any.whl
- Upload date:
- Size: 138.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1000a6a5edaa19f00262faf22fb93fda7966c090128ea1743c096eba8fcfd6fd
|
|
| MD5 |
d24f12b41bb48bbd2eb32484e7c27199
|
|
| BLAKE2b-256 |
2dfcaeb1c8830b2821f42b8f5936a1ec7b557240d9b0b973f84fd179906ab755
|