mercredi 17 mai 2023

AWS Simple Storage Service in action

 



AWS Simple Storage Service in action

Author: Donatien MBADI OUM, Oracle | AWS | Azure

 

1.     What is S3?


AWS S3 Overview

S3 stands for Amazon Simple Storage Service. It’s an object storage service that offers industry-leading scalability, data availability, security and performance. Amazon S3 is used to store and retrieve any amount of data anywhere on the web at a very low cost, for a wide range of user cases such as websites, mobile applications, data lakes, backup and restore, archive, IoT devices, big data analytics etc.

S3 is an object-based storage, and basically it manages data as object rather than in the file systems or data blocks. Objects can be up to 5 terabytes in size, so you can start with 0 bytes and the total volume of data and the number of objects you can store is unlimited.

S3 is a place to store your static files, so you can’t use S3 for:

-          Installing an Operating System (OS)

-          Running databases

 

You can push and pull data with S3 using AWS console, AWS SDK, AWS CLI and a number of popular programming languages.

2.    Buckets


We store our files in a thing called a bucket. An S3 bucket is basically similar to a folder inside S3. It’s a container for objects and you can have up to 100 buckets in your account.

When you create a bucket, enter a bucket name and choose the AWS region where the bucket reside. Each bucket name is globally unique and you cannot change the name of the bucket or its region. An object inside the bucket consists of:

-          Key  (or Key name): is the unique identifier for an object within a bucket

-          Version ID: You can enable S3 versioning to keep multiple variants of an object in the same bucket. Amazon generates a unique version ID for each object added to the bucket.

-          Value: The content that you are storing

-          Metadata: A set of name-value pairs with which you can store information regarding the object.

-          Access control information: You can control access to the objects you store in Amazon S3 using Access Control List (ACL) and bucket policies.

 

3.     Lab_01: Creating S3 buckets and Managing Objects

In this lab, we will create two S3 buckets and verify public vs non-public access to the buckets. We also enable and validate versioning based on uploaded objects. Before start, you will store the below images as cameroun.jpg and cameroun.jpg:

                    
cameroun1.jpg                                            cameroun2.jpg

 

3.1.  Create Public S3 bucket

 

a.       After logging in to the AWS Management Console using your account, navigate to S3


 

 

 

b.      Click on Create bucket


c.       Set the following values:

o   Bucket name: enter your unique bucket. Eg. testlab-public-mbadi01123456789

o   Region: Select your region. Eg. Canada (Central) ca-central-1


o   Object Ownership: Select ACLs enabled and Bucket owner preferred

 


 

d.      In the Block Public Access settings for this bucket section, uncheck the box for Block all public access. Check the box stating I acknowledge that the current settings might result in this bucket and the objects within becoming public to confirm that we understand the bucket is going to be public.

 


e.      Leave the rest of the settings as their defaults and click on Create bucket.

 


 

3.2. Create Private S3 bucket

 

a.       On the Buckets screen, click Create bucket

 

b.      Set the following :

 

o   Bucket name: Enter for example, E.g: testlab-private-mbadi0354978456

o   Region: Select your region, E.g: Canada (Central) ca-central-1

 


c.       Leave the rest of the settings as their defaults

d.      Click Create bucket


3.3.  Upload a File in the Private Bucket

 

a.       Select the private bucket name to open it

 

b.      In the Objects section, click Upload

 

 


 

c.       Click Add files


d.      Navigate to the files you downloads and upload the cameroun1.jpg image


 

e.      Leave the rest of the settings on the page as their defaults

 

f.        Click Upload

 


g.      After the file uploads successfully, click its name to view its properties


 

h.      Open the Object URL in a new browser tab. Since it’s a private bucket, you will see an error message.


i.        Back to the cameroun1.jpg page and select Object actions dropdown and note that the Make public using ACL option is disable because the bucket is private and we set the ownership to not use ACLs.


3.4. Upload a File in the Public Bucket

 

a.       Click Bucket in the link trail at the top

b.      Select the public bucket name to open it and click on Upload

c.       Click Add files and upload the cameroun2.jpg image


 

d.      Leave the rest of the settings on the page as their defaults and click Upload


e.      After the file uploads successfully, click its name to view its properties

 


f.        Open the Object URL in a new browser tab. You should receive an error message because although the bucket is public, the object is not.


 

 

g.      Back to the cameroun2.jpg page, select Object actions à Make public using ACL

 



 

h.      Click Make public


i.        Repeat f. You will see that the image should load


 

4.    Lab_02: Enabling Versioning

In this lab, we will enable versioning on the public bucket and validate access to different versions of files with the same name.

4.1. Enable Versioning

 

a.       On the public bucket page, click the properties tab. You will see that the Bucket Versioning is disabled


b.      In the Bucket Versioning section, click Edit

 


c.       Click Enable to enable bucket versioning


d.      Click Save Changes

 

4.2. Upload Another Image to test Versioning

 

a.       Click the Objects tab

 

b.      Click Upload and then click Add files

 

 

c.       Rename cameroun1.jpg to cameroun2.jpg and upload the newly renamed cameroun2.jpg image


d.      Click Upload

 


e.      After the file uploads successfully, click its name to view its properties

 

f.        Click the Versions tab. You should see there are two versions of the cameroun2.jpg file

 


 

4.3. View the image Versions

 

a.       Select Object actions àMake public using ACL

b.      Click Make public

c.       Click the Properties tab

d.      Open the Object URL in a new browser tab. This time, you should see the new image

 


e.      Back on the cameroun2.jpg page, click Versions tab

 

f.        Click the null object


 

g.       Open its Oject URL in an new browser tab. You should see the original cameroun2.jpg image you uploaded


How to fix errors : -         ORA-38760: This database instance failed to turn on flashback database -         ORA-38780: Restore poin...