easily manage and automate eks with aws cdk.
- aws cli
- aws cdk cli
- node & npm
- kubectl
install required dependencies:
npm i
bootstrap your cdk (if not already done yet):
cdk bootstrap
deploy the resources:
cdk deploy
give it some time to deploy the cluster and other related resources.
once it's deployed, copy the output that starts with aws eks update-kubeconfig
. it should look something like:
aws eks update-kubeconfig --name demogo --region <region> --role-arn <role-arn>
this will allow you to access the cluster directly via kubectl
.
now, port forward nginx svc on local port 8080 to test it:
kubectl port-forward svc/nginx 8080:80
finally visit localhost:8080 and voila - you should see nginx running!
on a new terminal, activate ts compiler watch mode:
npm run watch
check diff generated:
cdk diff
deploy the resources:
cdk deploy
destroy the app and resources:
cdk destroy
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template