h. Cleanup

Congratulations! You have completed the container orchestration lab and learnt how to deploy your containers using AWS Batch.

In Lab 3 you build and pushed your container to ECR in an automated way using CICD pipeline via CodeCommit and CodeBuild. In Lab 4 you deployed the same container using Batch.

In this section, you will clean all the resources that you created in Lab 3 and Lab 4.

Clean Up

After you complete the workshop, clean up your environment by following these steps:

  1. On the Cloud9 terminal run the following commands to delete the AWS Batch environment & resources you created:
aws cloudformation delete-stack --stack-name nextflow-batch-ce-jq --region $AWS_REGION
aws cloudformation delete-stack --stack-name nextflow-batch-jd --region $AWS_REGION

Note, it will take a few mins for the stacks to be deleted.

  1. Navigate to the AWS CloudFormation Dashboard of the AWS Management Console and confirm that the stacks are deleted.

  2. Navigate to Amazon S3 Dashboard of the AWS Management Console and delete the S3 bucket you created in Lab 4. Or, run the following CLI command on Cloud9.

source s3_vars
aws s3 rb s3://${BUCKET_NAME_RESULTS} --force
  1. Navigate to the ECR service in the AWS Management Console and delete the repository you created earlier. Or, run the following CLI command on Cloud9.
REPO_NAME=isc22-container
aws ecr delete-repository --repository-name $REPO_NAME --force --region $AWS_REGION
  1. Navigate to CodeCommit in the AWS Management Console and delete the repository you created in Lab 3. Or, run the following CLI command on Cloud9
CODECOMMIT_REPO_NAME=MyDemoRepo
aws codecommit delete-repository --repository-name $CODECOMMIT_REPO_NAME --region $AWS_REGION
  1. Navigate to CodeBuild in the AWS Management Console and delete the build project you created in Lab 3. Or, run the following CLI command on Cloud9
CODEBUILD_PROJECT_NAME=MyDemoBuild
aws codebuild delete-project --name $CODEBUILD_PROJECT_NAME --region $AWS_REGION
  1. Navigate to CodePipeline in the AWS Management Console and delete the pipeline that you creared in Lab 3. Or, run the following CLI command on Cloud9
CODEPIPELINE_NAME=MyDemoPipeline
aws codepipeline delete-pipeline --name $CODEPIPELINE_NAME --region $AWS_REGION
  1. Navigate to IAM and delete the following Policies (click on Policies on the left hand pane) created as part of the labs. Search for the below policies. Click on the Policy -> Action -> Delete. Follow the required steps to confirm deletion.
  • CodeBuildBasePolicy-<codebuild-project-name>-<region>
  • AWSCodePipelineServiceRole-<region>-<codepipeline-name>
  1. Navigate to IAM and delete the following Roles (click on Roles on the left hand pane) created as part of the labs. Search for the below roles. Click on the Role -> Action -> Delete. Follow the required steps to confirm deletion.
  • AWSCodePipelineServiceRole-<region>-<codepipeline-name>
  • codebuild-<codebuild-project-name>-service-role
  • ecsTaskExecutionRole