Cleanup
If you continue with workshop 137, you can keep or delete the fcajdms stack. Workshop 137 provides the SAM project; the sam deploy command updates the stack if it still exists, or recreates all the resources if you deleted it. When the stack is recreated, the User Pool and the buckets are new resources, so you need to sign up again and update amplify_outputs.json and APP_API_URL with the new Outputs.
This workshop only creates resources with AWS SAM, so clean up with the steps below:
- Empty the two S3 buckets of the stack, because CloudFormation cannot delete a bucket that still contains objects
- Run the following commands:
aws s3 rm s3://WEB_STORE_BUCKET --recursive
aws s3 rm s3://DOCUMENT_STORE_BUCKET --recursive
- Replace
WEB_STORE_BUCKET and DOCUMENT_STORE_BUCKET with the WebStoreBucket and DocumentStoreBucket values in the Outputs tab of the fcajdms stack.
- Delete the application stack
- Run the command below in the fcajdms-sam folder:
sam delete --stack-name fcajdms
- Enter
y to confirm the stack deletion, then enter y to delete the template and code files of the stack in the SAM bucket.
- This command deletes all the resources of the stack: the Cognito User Pool, User Pool Client, Identity Pool, the IAM roles, the two S3 buckets, the Documents table, the three Lambda functions and the fcaj-dms-api REST API.
- If you stop the series here, delete the stack that SAM CLI created to store deployment files
- Open the S3 console
- Select the bucket whose name starts with aws-sam-cli-managed-default-samclisourcebucket-
- Click Empty. This bucket has versioning enabled, and Empty deletes all versions of the objects.
- Enter permanently delete and click Empty
- Run the following command to delete the stack:
sam delete --stack-name aws-sam-cli-managed-default
- Delete the log groups of the Lambda functions (optional)
- Open the CloudWatch console
- Select the /aws/lambda/list_documents, /aws/lambda/upload_document and /aws/lambda/delete_document log groups
- Click Actions, select Delete log group(s) and click Delete