Skip to main content

CDK construct library for EC2 Spot

Project description

NPM version PyPI version Release

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 without compilation. See https://github.com/aws/jsii/issues/826
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 without compilation. See https://github.com/aws/jsii/issues/826
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 without compilation. See https://github.com/aws/jsii/issues/826
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.35.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk_ec2spot-0.1.35-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file cdk-ec2spot-0.1.35.tar.gz.

File metadata

  • Download URL: cdk-ec2spot-0.1.35.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for cdk-ec2spot-0.1.35.tar.gz
Algorithm Hash digest
SHA256 2cd5262e8ea41b7a71c13c9f0677a69590aa6e2daf53e1a9fcba997eba07fb27
MD5 1be90785c85237efa70c5ddd2681ca38
BLAKE2b-256 959ca5ece5b1317d17fb7f05326e481f47e480cc2572c34f9ef19a9c0b274598

See more details on using hashes here.

File details

Details for the file cdk_ec2spot-0.1.35-py3-none-any.whl.

File metadata

  • Download URL: cdk_ec2spot-0.1.35-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for cdk_ec2spot-0.1.35-py3-none-any.whl
Algorithm Hash digest
SHA256 29b1513d1a0de353df18e6d63499c949923e3935ca6542f65287780bf2c65d23
MD5 20c7cc995d7d71565b51de974bad8771
BLAKE2b-256 5aea83e5ba0bc1e13063ef08e1d570d9755690c86ae6d0bb27f3ee1d34e6bcf2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page