cdk-eks-spotblocks
cdk-eks-spotblocks
is a JSII construct library for AWS CDK to provison Amazon EKS cluster with EC2 Spot Blocks
for defined workloads with the advantages of ensured availability and considerable price reduction for your kubernetes workload.
Features
- support the upstream AWS CDK
aws-eks
construct libraries by extending its capabilities -
addSpotFleet()
to create your spot fleet for your cluster - define your
blockDuration
,validFrom
andvalidUntil
for fine-graned control - support any AWS commercial regions which has Amazon EKS and EC2 Spot Block support, including AWS China regions
Sample
;;; ; clusterStack.addSpotFleet'FirstFleet', clusterStack.addSpotFleet'SecondFleet',
check eks-spot-blocks-demo for a full AWS CDK demo with this construct library.
Custom AMI support
;
FAQ
eks-spot-blocks
support existing eks clusters created by eksctl
, terraform
or any other tools?
Does No. This construct library does not support existing Amazon EKS clusters. You have to create the cluster as well as the spot fleet altogether in this construct library.
Python
and Java
?
Can I write the CDK in other languages like Not at this moment. But we plan to publish this construct with JSII
so we can install this library via npm
, pypi
, maven
or nuget
.
How much time can I block the spotfleet?
You can block the fleet with hourly increments up to 6 hours.
blockDuration
?
What happens after the Spot Blocks ensure the availability of your spot instances during the blockDuration
and avoid termination during the price disruption. After the blockDuration
, by default, your spot instances will still be in running
state but it doesn't ensure the availability, which means it might be terminated anytime after the blockDuration
.
blockDuration
to save the money?
Can I terminate the fleet immediately after the Yes. Basically you can configure validFrom
, validUntil
and terminateInstancesWithExpiration
to achieve this.
However, consider the following scenario
<deploy start at 1:00>|--------(one hour)-----------------------|<2:00>
|<fleet created at 1:05>--------(one-hour block)-------|<2:05>
Your fleet will be terminated at 2:00
rather at 2:05
.
tains
and labels
supported?
Are Yes.
(samples TBD)
Does it support AWS China regions?
Yes. Including Beijing(cn-north-1
) and Ningxia(cn-northwest-1
).
How much can I save from the EC2 Spot Block compared to the on-demand?
According to this document
Spot Instances are also available to run for a predefined duration – in hourly increments up to six hours in length – at a discount of up to 30-50% compared to On-Demand pricing.
aws-eks
construct library?
Will this library become part of the upstream Probably. As it's still in the preliminary stage, we are still collecting feedbacks from the community to make eks-spot-blocks
ready for production workloads. Eventually we will commit this feature to the upstream aws-eks
construct library in AWS CDK through pull requests.