Dọn dẹp tài nguyên

Dọn dẹp tài nguyên

Xóa tài nguyên theo thứ tự sau để không còn gì phát sinh chi phí.

IAM Access Analyzer

  1. IAM console → Access analyzer → Analyzer settings, chọn FCJ-S3-Analyzer → Delete.

AWS Config (chỉ khi bạn đã thiết lập ở phần 8)

  1. AWS Config → Rules, chọn s3-bucket-public-read-prohibited → Actions → Delete rule.
  2. AWS Config → Settings → Edit, bỏ chọn Enable recording và lưu. Bạn cũng có thể chạy các lệnh sau trong 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 và xóa bucket delivery của Config fcj-config-lab-<suffix>.

VPC endpoint và bucket

  1. VPC console → Endpoints, chọn S3-Endpoint → Actions → Delete VPC endpoints.
  2. S3 console → mở bucket lab → Permissions, xóa bucket policy nếu vẫn còn.
  3. Chọn bucket lab → Empty, nhập permanently delete và xác nhận. (CloudFormation stack không xóa được bucket còn chứa object.)

CloudFormation stack

  1. Đóng tab Session Manager (Terminate session).
  2. CloudFormation console → chọn FCJ-S3-LAB → Delete. Stack sẽ xóa EC2 instance, IAM role và instance profile, bucket, security group và VPC.
  3. Chờ trạng thái DELETE_COMPLETE, rồi kiểm tra SID-vpc và bucket sid-security-* không còn tồn tại.