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 cdk_ec2spot as ec2spot
# create a ec2spot provider
provider = ec2spot.Provider(stack, "Provider")
# import or create a vpc
vpc = provider.get_or_create_vpc(stack)
# create an AutoScalingGroup with Launch Template for spot instances
provider.create_auto_scaling_group("SpotASG",
vpc=vpc,
default_capacity_size=2,
instance_type=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.create_fleet("SpotFleet",
vpc=vpc,
default_capacity_size=2,
instance_type=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.create_instance("SpotInstance", vpc=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.68.tar.gz
(35.6 kB
view hashes)
Built Distribution
Close
Hashes for cdk_ec2spot-0.1.68-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ea982f309190c30f9d8c09d983caffbae6427eaea340c309060da4b6e3c3d53 |
|
MD5 | 17d5620a357adca3aee86b5d12a3f1fb |
|
BLAKE2b-256 | be3b2ed658bc883dab9fcab631cc7548689bc64611c6b7d2a8adee55a01d7c89 |