Skip to main content

Command Palette

Search for a command to run...

Day 9 of #100DaysOfCode – Deep Dive into Amazon S3 Object Storage

Published
4 min read

Introduction

On Day 9 of my #100DaysOfCode journey, I explored Amazon Simple Storage Service (Amazon S3), a scalable, high-speed, web-based cloud storage service designed for online backup and archiving of data and application programs. In this blog post, I'll share what I learned about Amazon S3 concepts, use cases, security features, storage classes, and lifecycle management.


What is Amazon S3?

Amazon S3 is an object storage service that offers industry-leading scalability, data availability, security, and performance. Unlike block storage, which is tied to a specific compute instance, Amazon S3 allows you to store and retrieve any amount of data from anywhere on the web, making it ideal for a variety of use cases.


Understanding Amazon S3 Concepts

  • Buckets: Containers for storing objects. Before uploading data to Amazon S3, you must create a bucket. Bucket names must be unique globally and can store an unlimited number of objects.

  • Objects: The fundamental entities stored in Amazon S3. An object consists of data and metadata and is identified by a unique key (object name) within a bucket.

  • Keys: The unique identifier for an object within a bucket. Keys can simulate a folder hierarchy by using slashes (/) in the object name.


Amazon S3 Use Cases

  • Backup and Storage: Highly redundant storage ideal for backing up and archiving critical data.

  • Media Hosting: Store and serve media files like videos, images, and music.

  • Software Delivery: Host software applications for customers to download.

  • Data Lakes: Build scalable data lakes for big data analytics.

  • Static Websites: Host static websites directly from S3 buckets.

  • Static Content Storage: Ideal for storing static assets like images and scripts for web applications.


Security and Access Management

Private by Default: All S3 resources are private by default. You control who can access your data.

Access Control Methods:

  • IAM Policies: Attach policies to IAM users, groups, or roles to control access to S3 resources.

  • S3 Bucket Policies: JSON-based policies attached directly to buckets to control access at the bucket level.

Example S3 Bucket Policy:

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

Encryption Options:

  • Server-Side Encryption: Amazon S3 encrypts your data at rest after it is stored.

  • Client-Side Encryption: Data is encrypted before sending it to Amazon S3.


Versioning in Amazon S3

Enabling versioning on a bucket allows you to preserve, retrieve, and restore every version of every object stored in your buckets. This helps protect against accidental overwrites or deletions.

  • Versioning States:

    • Unversioned: Default state; versioning is not enabled.

    • Versioning-Enabled: Stores all versions of an object.

    • Versioning-Suspended: Stops accruing new versions; existing versions remain.


Amazon S3 Storage Classes

Amazon S3 offers different storage classes to help optimize costs based on data access patterns:

  1. S3 Standard: General-purpose storage for frequently accessed data.

  2. S3 Intelligent-Tiering: Automatically moves data between access tiers based on usage.

  3. S3 Standard-Infrequent Access (S3 Standard-IA): For data accessed less frequently but requires rapid access.

  4. S3 One Zone-Infrequent Access (S3 One Zone-IA): Lower-cost option storing data in a single Availability Zone.

  5. S3 Glacier Instant Retrieval: For rarely accessed data requiring milliseconds retrieval.

  6. S3 Glacier Flexible Retrieval: Low-cost storage for data accessed 1-2 times per year.

  7. S3 Glacier Deep Archive: Lowest-cost storage for long-term retention (7-10 years).

  8. S3 on Outposts: For storing data on-premises using AWS Outposts.


Lifecycle Management

You can automate the transition of objects to different storage classes or expiration using lifecycle policies:

  • Transition Actions: Define when objects transition to a different storage class.

  • Expiration Actions: Define when objects expire and should be deleted permanently.

Use Cases for Lifecycle Management:

  • Periodic Logs: Delete logs after a certain period.

  • Data with Changing Access Patterns: Transition data to infrequent access or archive classes as it ages.


Conclusion

Amazon S3 is a versatile and powerful storage service that caters to a wide range of needs. From hosting static websites to building scalable data lakes, understanding S3's features like bucket policies, versioning, storage classes, and lifecycle management is essential for optimizing storage costs and ensuring data durability.

I'm excited to apply these insights to real-world projects and continue exploring AWS services in the coming days!