AWS - SOA-C02

πŸ” AWS SysOps SOA-C02 Exam Prep: S3 Access Control (ACLs, Bucket Policies, IAM Policies)

πŸ“Œ Why Access Control Matters in Amazon S3

Amazon S3 stores sensitive data β€” so controlling who can access what is critical. AWS offers three main access control mechanisms you need to know for the SysOps exam:

  1. Bucket Policies
  2. IAM Policies
  3. Access Control Lists (ACLs)

Each method serves different purposes, with different levels of granularity and scope.

πŸ“– 1️⃣ Bucket Policies

Bucket Policies are JSON documents attached to an S3 bucket that define what actions are allowed or denied for which users, services, or accounts.

  • Applied at the bucket level
  • Supports resource-based permissions
  • Often used for public access, cross-account access, or service-specific permissions

Example: Allow public read access to a bucket

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicRead",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*"
    }
  ]
}

Pros:

  • Centralized, easy to manage
  • Can grant cross-account access
  • Resource-based (attached to the bucket)

Common exam use case:
βœ… Make a bucket public
βœ… Grant another AWS account access to a bucket

πŸ“– 2️⃣ IAM Policies

IAM Policies are attached to IAM users, groups, or roles. They define what actions a principal (user, group, or role) can perform on which AWS resources.

  • Applied at the identity level
  • Cannot make a bucket public (only allows authenticated users in your account)

Example: Grant full access to a bucket for a specific IAM role

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::my-bucket",
        "arn:aws:s3:::my-bucket/*"
      ]
    }
  ]
}

Pros:

  • Managed centrally in IAM
  • Can be attached to roles, users, and groups
  • Great for internal access control within your account

Common exam use case:
βœ… Allow an EC2 instance (using an IAM role) to upload files to S3

πŸ“– 3️⃣ Access Control Lists (ACLs)

S3 ACLs are the legacy access control method.

  • Applied to individual objects and buckets
  • Defines permissions for specific AWS accounts, groups, or the public
  • Limited to READ, WRITE, READ_ACP, WRITE_ACP actions

Example: Grant public read access to a specific object

aws s3api put-object-acl --bucket my-bucket --key myfile.txt --acl public-read

Pros:

  • Simple, good for object-level control
  • Useful for legacy apps

Cons:

  • Limited flexibility
  • AWS recommends using policies over ACLs

Common exam use case:
βœ… Temporarily grant public read access to a specific object
βœ… Share a file with another AWS account

πŸ“Š Comparison: Bucket Policies vs IAM Policies vs ACLs

FeatureBucket PolicyIAM PolicyACL
Applied ToBucketsIAM users, groups, rolesBuckets & Objects
ControlsWho can access the bucket & what actionsWhat actions IAM users/roles/groups can performWho can access objects/buckets
Public Accessβœ… Yes❌ Noβœ… Yes
Cross-account Accessβœ… Yes❌ Noβœ… Yes
GranularityBucket-levelUser-levelObject-level
Best Practiceβœ… Recommendedβœ… Recommended❌ Legacy, limited use

βœ… Common SOA-C02 Exam Scenarios

πŸ“ Scenario 1:
Make a bucket public
β†’ Use a Bucket Policy

πŸ“ Scenario 2:
Allow an EC2 instance to upload to an S3 bucket
β†’ Use an IAM Role with an IAM Policy

πŸ“ Scenario 3:
Allow a different AWS account to write to a bucket
β†’ Use a Bucket Policy with cross-account permissions

πŸ“ Scenario 4:
Temporarily grant public read access to a specific file
β†’ Use an Object ACL

πŸ“˜ S3 Block Public Access (Important!)

Even if Bucket Policies or ACLs allow public access, Block Public Access settings can override them to prevent accidental exposure.

  • Can be set at account or bucket level
  • Recommended to leave Block Public Access ON by default and only selectively disable

Exam Tip:
βœ… If public access isn’t working, check Block Public Access settings

βœ… Summary

FeatureDescription
Bucket PolicyResource-based access control at bucket level
IAM PolicyIdentity-based access control for IAM users, groups, roles
ACLLegacy object/bucket-level access permissions
Block Public AccessGlobal/public access override setting

Best Practice:
βœ… Use IAM Policies + Bucket Policies for access management
❌ Avoid ACLs where possible
βœ… Always configure Block Public Access appropriately

27 Views

Leave a Reply

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