Terraform S3 Bucket Policy


Goal of this project to create public S3 Bucket in AWS cloud and update Bucket policy to allow access to the bucket only from whitelisted public IPs.


  1. AWS IAM user access key & secret key accessing S3.
  2. Visual Studio Code configured to develop Terraform IaC

IaC Deployment

  1. Create S3 Bucket in ‘us-east-1’ region
  2. Enable Bucket versioning
  3. Update Bucket ACL to public access.
  4.  Create IAM policy to allow Bucket objects only from the specific whitelisted public IP (Get the public IP of your system to whitelist the IP)
  5. Update Bucket Policy with the IAM policy that created in step 3.


  1. Upload Object to Bucket using AWS CLI
  2. Access the Objects using Object URL from public browser(While your system has same public IP whitelisted)
  3. Access the Objects using Object URL from public browser (While your system has different public IP, Reconnect to internet might change your public IP for testing.)

© Edwiki Trainings – Click HERE If you are interested to learn more on Cloud & DevOps stack.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like