Setting up Secure and Scalable Storage Architecture With Low Latency
Tags: webdev, aws, s3, bucket
Published: 2024-04-06 14:50:32

_This project focuses on establishing a storage infrastructure that is both scalable and secure, while also ensuring minimal latency._



## Understanding AWS S3 Bucket

An AWS S3 Bucket is a cloud-based object storage service provided by Amazon Web Services (AWS), it is a virtual container within Amazon Simple Storage Service (S3) that acts like a digital file folder and is also designed to store and retrieve any amount of data from anywhere on the web. 


**Here are some key features and functionalities of the S3 Bucket:**


**Scalability:** S3 is highly scalable, meaning it can accommodate a virtually unlimited amount of data. As your storage requirements grow, S3 automatically scales to meet your needs without any upfront provisioning.

**Durability:** Stores data redundantly across multiple facilities to ensure exceptional data durability of almost 100%. This high level of durability is achieved by replicating data across multiple geographically dispersed data centers.


**Security:** S3 offers various security features to help you protect your data. This includes access control mechanisms such as bucket policies and Access Control Lists (ACLs), encryption options for data in transit and at rest, and integration with AWS Identity and Access Management (IAM) for fine-grained access control.

**Versioning:** S3 supports versioning, which allows you to keep multiple versions of an object in the same bucket. This feature helps protect against accidental deletion or overwrite of objects.


**Cost-Effectiveness:** Provides various storage classes to optimize costs based on your data access frequency.

**Integration with Other AWS Services:** S3 integrates seamlessly with other AWS services, making it easy to use as a storage backend for applications hosted on AWS. For example, you can use S3 to host static websites, store backups for Amazon EC2 instances, or serve as a data lake for analytics workloads.

**Logging and Monitoring:** S3 provides logging capabilities to track access to your bucket and objects, allowing you to audit and monitor usage. Additionally, you can configure event notifications to trigger AWS Lambda functions or other AWS services in response to specific bucket events.

We have three (3) tasks to accomplish in this project, namely;

Task 1: Data stored in the S3 bucket must not have a single point of failure.

Task 2: Create a narration.txt file and store financial information in it. Without granting IAM access, create a temporary link that will expire after 10 minutes to someone in the IT department.

Task 3: Create an s3 bucket and upload an object, but you are not allowed to execute this task using the console, what would be your approach?


Before going into our first task, we need to create an s3 bucket.

To sign in to the AWS Management Console, 
visit https://console.aws.amazon.com/


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ihurx18szcempta7jmg0.PNG)

Then navigate to S3 by clicking on the "Services" dropdown menu at the top-left corner and select "S3" under the "Storage" section.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ftu49zjtvlxn7yxkiht.PNG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1o9axi5n2y77b4ru7ej.PNG)

Click on Create S3 bucket.


## TASK 1
Data stored in the S3 bucket must not have a single point of failure.

To achieve more than one point of failure, enable cross-region replication and implement multiple availability zones/regions in the S3 bucket creation. Select a region closer to the region where the bucket is created, then select the directory option. Choose an availability zone closer to the AWS region that was selected. 

Then create bucket.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqfnc31ok3ruazllrwvx.PNG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1jo9fty7svpo5zag9yfy.PNG)


Task 2: 

Create a narration.txt file and store financial information in it. Without granting IAM access, create a temporary link that will expire after 10 minutes to someone in the IT department.

navigate into the bucket by clicking on its name. Then click on the "Upload" button.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfsu9vom1cnkjqa1t1qz.PNG)


Click on the "Add files" button and select the narration.txt file containing the financial information from your local file system.


To create a temporary link that will expire after 10 minutes to someone in the IT department, we will need to configure AWS in CLI.

Step 1
To do this, Go to IAM Dashbaord and navigate to users, click on the user you want to use.

Step 2
Click on Security Credentials, Under Access keys, click on create access keys.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqqp624f2o40llj934kz.PNG)


Step 3
Choose Command Line Interface(CLI) and give it a description then create. DO write down or download the keys

Step 4
Open Command Prompt(cmd) and configure aws usng 

> aws configure


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4m7u3lwd23souym83qx2.PNG)



Step 5 
type this command 

> aws s3 presign s3://your-bucket-name/account.txt --expires-in 600


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovr92nmbbrfgyd1nd6pm.PNG)




Task 3:
Create an s3 bucket and upload an object, but you are not allowed to execute this task using the console, what would be your approach?

If I cannot use the AWS Management Console to create an S3 bucket and upload an object, I can achieve this task using the AWS Command Line Interface (CLI)



Using the 'aws s3 mb s3://mybucket' command, I would create a new S3 bucket. I would specify the bucket name and the region where I want to create the bucket.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jkz3rtujgf3uxk3xmsak.PNG)


To upload an image in the bucket, do the following command.


aws s3 cp /path/to/local/file/example.txt s3://my-bucket-name/example.txt

By following these steps, I would be able to create an S3 bucket and upload an object without using the AWS Management Console, leveraging the AWS CLI for automation and scripting purposes.


Thanks for following through on this point. Do comment and subscribe