Skip to main content

EC2 Spot Block with Single Instance and EIP

Project description

Welcome to cdk-spot-one

EC2 Spot Block with Single Instance and EIP

Sample

Create a single EC2 spot instance for 6 hours with EIP attached:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_spot_one import SpotFleet

fleet = SpotFleet(stack, "SpotFleet",
    target_capacity=1,
    instance_interruption_behavior=InstanceInterruptionBehavior.HIBERNATE,
    default_instance_type=ec2.InstanceType("c5.large"),
    eip_allocation_id="eipalloc-0d1bc6d85895a5410",
    vpc_subnet={
        "subnet_type": ec2.SubnetType.PUBLIC
    },
    terminate_instances_with_expiration=True
)

# fleet to expire after 6 hours
fleet.expire_after(Duration.hours(6))

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-spot-one-0.1.6.tar.gz (29.4 kB view hashes)

Uploaded Source

Built Distribution

cdk_spot_one-0.1.6-py3-none-any.whl (28.4 kB view hashes)

Uploaded Python 3

Supported by

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