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.0.61.tar.gz (35.4 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.0.61-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cdk-ec2spot-0.0.61.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9

File hashes

Hashes for cdk-ec2spot-0.0.61.tar.gz
Algorithm Hash digest
SHA256 aa53c9bbba5951458917b997b39d8d2880a36795467466d1432e43d592a0ffde
MD5 8a4d50ec203160d1781cd670b8d13ea9
BLAKE2b-256 b8016920cb5df2d79939f5d41ddc37cb9e459502a6476b3510bde2b46437a9e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cdk_ec2spot-0.0.61-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9

File hashes

Hashes for cdk_ec2spot-0.0.61-py3-none-any.whl
Algorithm Hash digest
SHA256 373e5c1c6fceea02181dfcb19b7afca6c766411e32762f47cb7d23a830f1de30
MD5 33fed3e6092c2ea6599ac51c25c6d8a2
BLAKE2b-256 53f40fdbc40fa2c30868d35a92d227c2ae799b22fa4f4bb4a4a3c49332a139c9

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