Amazon S3 - Cloud Object Storage (Short topics)

Anil KushwahaAnil Kushwaha
5 min read

Amazon Simple Storage Service (S3) is a highly scalable and secure cloud storage service provided by Amazon Web Services (AWS). It allows you to store and retrieve large amounts of data, such as files, images, videos, and backups, on the internet. S3 offers durability, availability, and low latency for accessing your stored objects.

Here are some key features of Amazon S3:

  1. Scalability: S3 can handle virtually unlimited amounts of data, allowing you to store and retrieve any amount of information, from a few gigabytes to multiple petabytes.

  2. Durability and Availability: S3 is designed to provide 99.999999999% (11 nines) durability, meaning that your data is highly resistant to loss. It also offers high availability, ensuring that your data is accessible whenever you need it.

  3. Security: S3 provides several security mechanisms to protect your data, including server-side encryption, access control policies, and integration with AWS Identity and Access Management (IAM) for fine-grained access control.

  4. Data Management: S3 allows you to manage your data efficiently with features like versioning, lifecycle policies, cross-region replication, and event notifications. You can automate data movement and expiration, and easily track changes and recover previous versions of objects.

  5. Integration: S3 seamlessly integrates with other AWS services, such as AWS Lambda, Amazon Glacier, Amazon CloudFront, and Amazon Athena, enabling you to build powerful applications and workflows using a wide range of tools and services.

  6. Cost-effective: S3 offers a pay-as-you-go pricing model, where you pay only for the storage you use and the data transfer you consume. It provides cost optimization features like storage classes, which offer different levels of performance and cost, to help you manage your storage costs effectively.

In summary, Amazon S3 is a highly reliable, scalable, and secure cloud storage service that provides easy and cost-effective storage for your data, with a wide range of features and integration options to meet your specific needs.

Q. 1 How to Create Bucket in AWS:-

To create a bucket in AWS using Amazon S3, follow these steps:

  1. Log in to the AWS Management Console.

  2. Go to the Amazon S3 service.

  3. Click on the "Create bucket" button.

  4. Provide a unique name for your bucket. Bucket names must be globally unique across all AWS accounts.

  5. Select the region where you want to create the bucket. Consider choosing a region closer to your intended users for better performance.

  6. Configure the other settings as needed, such as versioning, logging, and tags. These are optional.

  7. Choose the appropriate permissions for your bucket. You can specify who has access to the bucket and what actions they can perform.

  8. Click on the "Create bucket" button to create the bucket.

    That's it! You have now successfully created a bucket in AWS using Amazon S3.

    Q. 2 Next, how to public object url by allowing policy generator.

    https://s3bucket-v1.s3.ap-southeast-1.amazonaws.com/1.png

    Uncheck "block all public access" from the bucket setting tab.

    Copy the above-generated policy and paste it under "Edit Bucket Policy" and add /* to assign the generated policy to which object of this bucket and next save the changes.

    Now you can test and open the Object S3 URL by going through the below screenshot.

    That's it! You have now successfully generated a policy for the object URL and the object URL is accessible now.

    Q. 3 What is Versioning and how to prevent an Object from deletion?

    Create a new bucket in the name of "demo-s3-bucket22" with the default configuration.

    Upload a sample image name "1.png" under this folder and try to access this 1.png file by s3 url before of this we have to generate a policy for this new s3 bucket name "demo-s3-bucket22" which I did the same in above Q no.2.

    Now we have to enable the s3 versioning of our second bucket i.e. "demo-s3-bucket22"

    Now S3 versioning is enabled to check I have uploaded another image content file with the same name which was uploaded earlier i.e. "1.png"

    Below you can see the file version is visible now but here a point is to be noted the price of s3 is higher than normal in case of enabling versioning.

    Let's examine the scenario where the file "1.png" is being accessed with varying image content through the utilization of S3 versioning. It's important to note that once versioning is activated, it cannot be disabled.

    That's all there is to it! You've now gained an understanding of how S3 versioning is enabled and functions.

    Q. 4 How to host Static Website in S3.

    Create a new bucket.

    Upload a sample index.png file in this bucket and open it.

    http://demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com/

    Here, we have to generate a policy again for this new s3 bucket name "demo22-staticwebsite" which I did the same in Q no.2 above and after generating the policy our S3 URL will become accessible now.

    http://demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com

    OR

    http://demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com/index.png

    If you want to display or set the error page means the page which is searched by visitors is generally not existed then need to follow the below steps.

    Currently, this ".../404page" is not exist and after setting it up the particular error page will be displayed in its place which just not existed in the URL.

http://demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com/404page

or

http://demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com/400page

That's it the static website is hosted successfully with the required settings.

Q. 5 How to redirect in S3 static website from one link to another link.

Create a new bucket with the same previous bucket name added with the www prefix.

Next, Enabled the static website feature on the new "www" bucket and entered the redirect URL.

Now we open our new "www" bucket URL and it should be redirected to the non "www bucket link before please generate the policy by going through the above no. 2.

http://www.demo22-staticwebsite.s3-website-ap-southeast-1.amazonaws.com

Thanks,

Anil Kushwaha

0
Subscribe to my newsletter

Read articles from Anil Kushwaha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anil Kushwaha
Anil Kushwaha

As a technology enthusiast with a passion for efficient operations, I specialize in Linux, AWS Cloud, Prometheus-Grafana, Security, Virtualization, and Git. With a deep understanding of these technologies, I am able to streamline development processes and ensure smooth operations for businesses.