Clean Up Resources

Clean Up Resources

After completing the workshop, it’s essential to clean up AWS resources to avoid unexpected costs beyond the Free Tier. This section guides you through deleting the resources created: CloudFront, S3, API Gateway, Lambda, DynamoDB, and IAM.

Why Clean Up:

  • Cost Savings: Prevent unnecessary charges from unused resources.
  • Security: Remove IAM permissions and resources to avoid unauthorized access.
  • Organization: Keep your AWS account tidy for future projects.

Clean Up Resources

  1. Delete CloudFront Distribution

    • Go to CloudFront.
    • Select the distribution you created (e.g., d1234567890abcdef.cloudfront.net).
    • Click Disable, wait for the status to change to Disabled.
    • Click Delete to remove the distribution.

    delete-distribution.png

  2. Delete S3 Bucket

    • Go to S3.
    • Select the bucket you created (e.g., blog-workshop-<your-account-id>).
    • Click Empty, type permanently delete to confirm, then select Empty.
    • After the bucket is emptied, click Delete, enter the bucket name in the confirmation field, and click Delete bucket.

    delete-bucket.png

  3. Delete API Gateway

    • Go to API Gateway.
    • Select the BlogAPI API.
    • Click ActionsDelete, enter the API name to confirm, then click Delete.

    delete-api.png

  4. Delete Lambda Functions

    • Go to Lambda.
    • Select the getPosts function, click ActionsDelete, and confirm.
    • Repeat for the createPost function.

    delete-lambda.png

  5. Delete DynamoDB Table

    • Go to DynamoDB.
    • Select the Posts table.
    • Click ActionsDelete table, enter the table name to confirm, then click Delete.

    delete-table.png

  6. Clean Up IAM Resources

    • Go to IAM.
    • Under Policies, select the lambda-blog-policy (or similar), click Delete, and confirm.
    • Under Roles, select the lambda-blog-role, click Delete, and confirm.

    delete-iam.png

Ensure the S3 bucket is emptied before deleting it. Double-check resources to avoid deleting those used by other projects. If deletion fails (e.g., resources in use), check dependencies (like Lambda permissions or API Gateway integrations).

Done

  • You have successfully cleaned up all resources related to the workshop, preventing further costs.