Cleanup

Congratulations on completing the GitOps with Weave Flux module.

This module is not used in subsequent steps, so you can remove the resources now, or at the end of the workshop.

First, delete all images from the Amazon ECR Repository.

Next, go to the CloudFormation Console and delete the stack used to deploy the image build CodePipeline

Now, delete Weave Flux and your load balanced services

helm uninstall flux --namespace flux
kubectl delete namespace flux 
kubectl delete crd helmreleases.flux.weave.works

helm uninstall mywebserver
kubectl delete namespace nginx
kubectl delete svc eks-example -n eks-example
kubectl delete deployment eks-example -n eks-example
kubectl delete namespace eks-example

Optionally go to GitHub and delete your k8s-config and eks-example repositories.

If you are using your own account for this workshop, continue with the below steps. If doing this at an AWS event, skip the steps below.

Remove IAM roles you previously created

aws iam delete-role-policy --role-name eksworkshop-CodePipelineServiceRole --policy-name codepipeline-access 
aws iam delete-role --role-name eksworkshop-CodePipelineServiceRole
aws iam delete-role-policy --role-name eksworkshop-CodeBuildServiceRole --policy-name codebuild-access 
aws iam delete-role --role-name eksworkshop-CodeBuildServiceRole

Remove the artifact bucket you previously created

ACCOUNT_ID=$(aws sts get-caller-identity | jq -r '.Account')
aws s3 rb s3://eksworkshop-${ACCOUNT_ID}-codepipeline-artifacts --force