Step 5: (Optional) Cleanup
Follow these steps to remove all the resources created in this tutorial.
Remove the resources created in this tutorial
Delete your deployment. You can use the following command to do so.
kubectl delete deployment
my-keyspaces-app
-nmy-eks-namespace
Delete the Amazon EKS cluster and all Pods contained in it. This also deletes related resources like the service account and OIDC identity provider. You can use the following command to do so.
eksctl delete cluster --name
my-eks-cluster
--regionaws-region
Delete the IAM role used for the Amazon EKS service account with access permissions to Amazon Keyspaces. First, you have to remove the managed policy that is attached to the role.
aws iam detach-role-policy --role-name
my-iam-role
--policy-arn arn:aws:iam::aws:policy/AmazonKeyspacesFullAccessThen you can delete the role using the following command.
aws iam delete-role --role-name
my-iam-role
For more information, see Deleting an IAM role (Amazon CLI) in the IAM User Guide.
Delete the Amazon ECR repository including all the images stored in it. You can do so using the following command.
aws ecr delete-repository \ --repository-name
my-ecr-repository
\ --force \ --regionaws-region
Note that the
force
flag is required to delete a repository that contains images. To delete your image first, you can do so using the following command.aws ecr batch-delete-image \ --repository-name
my-ecr-repository
\ --image-ids imageTag=latest \ --regionaws-region
For more information, see Delete an image in the Amazon Elastic Container Registry User Guide.
Delete the Amazon Keyspaces keyspace and table. Deleting the keyspace automatically deletes all tables in that keyspace. You can use one the following options to do so.