Clean up resources

Clean up resources

Delete the resources in this order so that nothing keeps generating charges.

IAM Access Analyzer

  1. IAM console → Access analyzer → Analyzer settings, select FCJ-S3-Analyzer → Delete.

AWS Config (only if you set it up in section 8)

  1. AWS Config → Rules, select s3-bucket-public-read-prohibited → Actions → Delete rule.
  2. AWS Config → Settings → Edit, clear Enable recording and save. You can also run the following commands in CloudShell:
aws configservice stop-configuration-recorder --configuration-recorder-name default
aws configservice delete-delivery-channel --delivery-channel-name default
aws configservice delete-configuration-recorder --configuration-recorder-name default
  1. Empty and delete the Config delivery bucket fcj-config-lab-<suffix>.

VPC endpoint and bucket

  1. VPC console → Endpoints, select S3-Endpoint → Actions → Delete VPC endpoints.
  2. S3 console → open the lab bucket → Permissions, delete the bucket policy if one is still attached.
  3. Select the lab bucket → Empty, type permanently delete and confirm. (The CloudFormation stack cannot delete a bucket that still contains objects.)

CloudFormation stack

  1. Close the Session Manager tab (Terminate session).
  2. CloudFormation console → select FCJ-S3-LAB → Delete. The stack deletes the EC2 instance, the IAM role and instance profile, the bucket, the security group and the VPC.
  3. Wait for DELETE_COMPLETE, then verify that SID-vpc and the sid-security-* bucket no longer exist.