Building a Serverless Web Application With AWS - Final Act
Tags: awscleanup, awsserverless, awslambda, awsiam
Published: 2022-11-22 13:21:31

To finish this project, we will go through the steps to terminate all the resources you created throughout this lab because we don't want this to be our story.


![EC2 meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmew0ptz1f73fu08tavk.jpg) 

I decided to make this a post on it's own because the other posts are waaaaaaaaay too long and nobody likes a long ass post. This is going to be really quick and sweet.

Hope you enjoyed the project and more importantly, hope you can speak to it. Try and redo it multiple times and write down everything you learn and your understanding of the whole process. It will make for a very interesting project discussiion in interviews.

##  Resource Cleanup

We will go through the steps to terminate all the resources we created throughout this tutorial. We will terminate our AWS Amplify app, the Amazon Cognito User Pool, our AWS Lambda function, IAM role, DynamoDB table, REST API, and CloudWatch Log. 

You already know it is a best practice to delete resources you are no longer using to avoid unwanted charges.

### Delete your Amplify app

- a) In the AWS Management Console choose Services then select AWS Amplify under Mobile.

- b) Select the app you created in Act 1.

- c) On the app landing page, choose ‘Actions > Delete app’. Enter ‘delete’ when prompted to confirm, then choose confirm.

### Delete your Amazon Cognito User Pool

-a) From the AWS Console click Services then select Cognito under Security, Identity and compliance.

- b) Choose Manage your User Pools.

- c) Select the WildRydes user pool in Amazon Cognito.

- d) Choose Delete Pool in the upper right corner of the page.

- e) Type delete and choose Delete Pool when prompted to confirm.

### Delete the AWS Lambda function

- a) In the AWS Management Console, click Services then select Lambda under Compute.

- b) Select the RequestUnicorn function you created.

- c) From the Actions drop-down, choose Delete function.

- d) Choose Delete when prompted to confirm.

### IAM Role

- a) In the AWS Management Console, click Services then select IAM under Security, Identity & Compliance.

- b) Select Roles from the left navigation pane.

- c) Enter WildRydesLambda into the filter box.

- d) Select the role you created in Module 3.

- e) Select the Role and choose Delete. Confirm the role name that needs to be deleted by entering WildRydesLambda. Choose Delete role. 

- f) Choose Yes, Delete when prompted to confirm.


### Amazon DynamoDB Table

- a) In the AWS Management Console, click Services then select DynamoDB under Databases

- b) Choose Tables in the navigation menu.

- c) Choose the Rides table you created.

- d) Choose Delete at the top right.

- e) Leave the checkbox to Delete all CloudWatch alarms for this table selected and choose Delete.

### Delete the REST API 

There is a Delete API option in the Actions drop-down when you select your API in the Amazon API Gateway Console.

- a) In the AWS Management Console, click Services then select API Gateway under Networking and Content delivery.
- b) Select the API you created.
- c) Expand the Actions drop-down and choose Delete API.
- d) Enter the name of your API when prompted and choose Delete API.

### Delete your CloudWatch Logs

AWS Lambda automatically creates a new log group per function in Amazon CloudWatch Logs and writes logs to it when your function is invoked. You should delete the log group for the RequestUnicorn function. Also, if you launched any CloudFormation stacks, there may be log groups associated with custom resources in those stacks that you should delete.

a. From the AWS Console click Services then select CloudWatch under Management and Goverance.
b. Choose Logs in the navigation menu.
c. Select the /aws/lambda/RequestUnicorn log group. If you have many log groups in your account, you can type /aws/lambda/RequestUnicorn into the Filter text box to easily locate the log group.
d. Choose Delete log group from the Actions drop-down.
e. Choose Yes, Delete when prompted to confirm.

There you have it guys, we have completed this project.
Congratulations! You built and terminated a serverless web application using AWS.

Thanks for sticking to the end. See you sometime later.