A sample CDK application to create a sample Amazon EKS cluster.
npm i -g aws-cdk
create a default eks clsuter in a new vpc with 2 x m5.large
for the managed nodegroup.
cdk deploy
create a default eks clsuter in the default vpc
cdk deploy -c use_default_vpc=1
create a default eks clsuter in a specific VpcId
cdk deploy -c use_vpc_id=vpc-xxxxxx
When you specify spot_only=1
, you will get a spot managed nodegroup diversified and distributed with predefined instance types : t3.large
, c5.large
and m5.large
.
create spot-only managed nodegroup
cdk deploy -c spot_only=1
(Node: you don't have to specify spotPrice
)
specify different instance type
for a on-demand managed nodegroup.
cdk deploy -c instance_type=t3.large
specify different capacity
cdk deploy -c default_capacity=3
(this will create 3
x m5.large
instances)
This will create 1
x t3.large
spot instance in the default vpc
for the Amazon EKS
npx cdk deploy \
-c use_default_vpc=1 \
-c spot_only=1 \
-c default_capacity=1 \
-c instance_type=t3.large