# Reproducing the lab on a REAL throwaway bucket
**Not run by me for the post. Use a test account, a unique bucket name, and delete everything afterwards.**
Note: AWS has made new buckets safer by default (Block Public Access on, ACLs disabled), so to reproduce the
exposure you must deliberately switch those off first. Do it only on a bucket with no real data.

```bash
B=your-unique-test-bucket-name
aws s3api create-bucket --bucket $B --region us-east-1
echo "test" > q3.csv && aws s3 cp q3.csv s3://$B/reports/q3.csv

# 1. baseline: should be 403
curl -I https://$B.s3.amazonaws.com/reports/q3.csv

# 2. allow a public policy (turn the protection off), then attach policies/bad_get.json (edit the bucket name inside it)
aws s3api put-public-access-block --bucket $B --public-access-block-configuration \
  BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false
aws s3api put-bucket-policy --bucket $B --policy file://policies/bad_get.json
curl -I https://$B.s3.amazonaws.com/reports/q3.csv     # expect 200

# 3. lock down
aws s3api put-public-access-block --bucket $B --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
curl -I https://$B.s3.amazonaws.com/reports/q3.csv     # expect 403
aws s3api put-bucket-policy --bucket $B --policy file://policies/bad_get.json   # expect AccessDenied

# 4. remove the leftover policy
aws s3api delete-bucket-policy --bucket $B

# 5. clean up
aws s3 rm s3://$B --recursive && aws s3api delete-bucket --bucket $B
```
