0.0.4-development • Published 3 years ago

@tksst/vlvtf68453i3jt57swttasdfasdf v0.0.4-development

Weekly downloads
-
License
CC0-1.0
Repository
github
Last release
3 years ago

cdk-ec2-spot-simple

CDK construct library to create EC2 Spot Instances simply.

Install

npm install xxxxxxxx

Usage

import { SpotInstance } from "xxxx"
import * as ec2 from "aws-cdk-lib/ec2"

// You should just use "SpotInstance" instead of "ec2.Instance"
new SpotInstance(this, "StoppableSpotInstance", {
    // Required properties of "ec2.Instance"
    vpc: ec2.Vpc.fromLookup(this, "defaultVPC", { isDefault: true });,
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3A, ec2.InstanceSize.NANO),
    machineImage: new ec2.AmazonLinuxImage(),
});

// You should just use "SpotInstance" instead of "ec2.Instance"
new SpotInstance(this, "StoppableSpotInstance", {
    // Required properties of "ec2.Instance"
    vpc: ec2.Vpc.fromLookup(this, "defaultVPC", { isDefault: true });,
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3A, ec2.InstanceSize.NANO),
    machineImage: new ec2.AmazonLinuxImage(),
    // SpotInstance specific property
    spotOptions: {
        interruptionBehavior: ec2.SpotInstanceInterruption.STOP,
        requestType: ec2.SpotRequestType.PERSISTENT,
    },
});