CDK construct library for EC2 Spot
Project description
cdk-ec2spot
CDK construct library that allows you to create EC2 Spot instances with AWS AutoScaling Group, Spot Fleet or just single Spot Instance.
Install
Use the npm dist tag to opt in CDKv1 or CDKv2:
// for CDKv2
npm install cdk-ec2spot
or
npm install cdk-ec2spot@latest
// for CDKv1
npm install cdk-ec2spot@cdkv1
Sample
import * as ec2spot from 'cdk-ec2spot';
// create a ec2spot provider
const provider = new ec2spot.Provider(stack, 'Provider');
// import or create a vpc
const vpc = provider.getOrCreateVpc(stack);
// create an AutoScalingGroup with Launch Template for spot instances
provider.createAutoScalingGroup('SpotASG', {
vpc,
defaultCapacitySize: 2,
instanceType: new ec2.InstanceType('m5.large'),
});
EC2 Spot Fleet support
In addition to EC2 AutoScaling Group, you may use createFleet() to create an EC2 Spot Fleet:
provider.createFleet('SpotFleet', {
vpc,
defaultCapacitySize: 2,
instanceType: new ec2.InstanceType('t3.large'),
});
Single Spot Instnce
If you just need single spot instance without any autoscaling group or spot fleet, use createInstance():
provider.createInstance('SpotInstance', { vpc })
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 cdk-ec2spot-2.0.292.tar.gz.
File metadata
- Download URL: cdk-ec2spot-2.0.292.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df497ed6d72192ffd8f26967fb1654c226c819631a8504d68697578604ca4335
|
|
| MD5 |
db2eb832d55183b90eeed0a45a759c21
|
|
| BLAKE2b-256 |
080ef5988e89de414cf1169fbdca0e8e2915500221b1586ee432f67c76b358dc
|
File details
Details for the file cdk_ec2spot-2.0.292-py3-none-any.whl.
File metadata
- Download URL: cdk_ec2spot-2.0.292-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ed7fc3b838f07f07e0714f241c05c3e39859d973e1683110d3fcf11662c7665
|
|
| MD5 |
9ca6596d95c4e6ef1d76ab2cfa06d7ef
|
|
| BLAKE2b-256 |
7b47142137d0e0dc4a88f94e36d4ff10d06ccb98587208d23a878585741caf21
|