Amazon S3 (Simple Storage Service) is a highly scalable object storage service provided by AWS. Setting up an S3 bucket and assigning permissions involves several steps, including creating the bucket, configuring access policies, and uploading .json permission files. This guide will walk you through the entire process.

Step 1: Log In to Your AWS Management Console

  1. Go to the AWS Management Console.
  2. Log in with your credentials.

Step 2: Create an S3 Bucket

  1. Navigate to the S3 service from the AWS Management Console.
  2. Click on Create bucket.
  3. Fill in the required details:
    • Bucket Name: Enter a unique name for your bucket. (Bucket names must be globally unique.)
    • Region: Choose the AWS Region where you want to host your bucket.
  4. Configure optional settings:
    • Object Ownership: Select ACLs disabled or ACLs enabled depending on your requirement.
    • Bucket Versioning: Enable versioning if you want to keep multiple versions of objects.
    • Default Encryption: Enable encryption for enhanced security.
  5. Click Create bucket.

Step 3: Configure Bucket Permissions

By default, S3 buckets are private. To grant permissions, you can use bucket policies and access control lists (ACLs).

Using a JSON Policy File

  1. Access the Bucket Permissions:
    • Click on your bucket name from the S3 dashboard.
    • Go to the Permissions tab.
  2. Edit Bucket Policy:
    • Under the Bucket policy section, click Edit policy.
    • Use a JSON file to define permissions.

Sample JSON Policies

Grant Public Read Access:

{
  “Version”: “2012-10-17”,
  “Statement”: [
    {
      “Sid”: “PublicReadGetObject”,
      “Effect”: “Allow”,
      “Principal”: “*”,
      “Action”: “s3:GetObject”,
      “Resource”: “arn:aws:s3:::your-bucket-name/*”
    }
  ]
}

Replace your-bucket-name with the actual name of your bucket.

Grant Access to a Specific IAM User:

{
  “Version”: “2012-10-17”,
  “Statement”: [
    {
      “Sid”: “AllowUserAccess”,
      “Effect”: “Allow”,
      “Principal”: {
        “AWS”: “arn:aws:iam::account-id:user/user-name”
      },
      “Action”: “s3:*”,
      “Resource”: [
        “arn:aws:s3:::your-bucket-name”,
        “arn:aws:s3:::your-bucket-name/*”
      ]
     }
  ]
}

Replace account-id and user-name with the appropriate IAM user details.

3. Paste the JSON policy into the editor and click Save changes.

Step 4: Test the Permissions

  1. Use the AWS CLI or AWS SDK to test the bucket access.
  2. Ensure that only the intended users or services can access the bucket.

Step 5: Upload Files to Your Bucket

  1. Navigate to your bucket in the S3 console.
  2. Click Upload and choose files or folders to upload.
  3. Configure permissions for uploaded files if required.
  4. Click Upload to complete the process.

Step 6: Manage and Monitor Bucket Usage

  1. Enable AWS CloudWatch to monitor bucket activities.
  2. Set up S3 Event Notifications to trigger actions on object creation or deletion.
  3. Regularly review and update bucket policies to maintain security.

Creating an S3 bucket and assigning permissions is straightforward but requires careful attention to detail to ensure security and accessibility. By using JSON policies, you can fine-tune permissions and control access effectively. Follow these steps to set up your bucket and manage permissions with confidence.

Next article – Step 5: Installing AWS CLI and Connecting CMD to Amazon Web Services

We are here to help!

Contact us to help you set up your AWS WorkSpaces account.