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
.
Sample
# Example automatically generated from non-compiling source. May contain errors.
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:
# Example automatically generated from non-compiling source. May contain errors.
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()
:
# Example automatically generated from non-compiling source. May contain errors.
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
cdk-ec2spot-0.1.70.tar.gz
(35.6 kB
view hashes)
Built Distribution
Close
Hashes for cdk_ec2spot-0.1.70-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38930514d7309b7d9cbf6ef5b8d1354bf5c12eb388e2cd139264640856cd1930 |
|
MD5 | 0cbfd1c8802ea4c3cd7a3a4937c9ca19 |
|
BLAKE2b-256 | 4e6bbd450be4f57de9a03959dbcacd7102883f175eee56995f19dbb5efd44f49 |