Course Content
Introduction to Cloud Computing
Introduction to Cloud Computing
Amazon Simple Storage Service Configuration
Starting to learn AWS services should begin with the basics.
Therefore, we will start with a service like S3, which is used by everyone, always. Even the images I include in this course are stored on S3, any media information, and sometimes code snippets or scripts that perform various functions.
Let's start with the definition:
Creating a Bucket
Now, let's start working with S3. First, we need to access this service by clicking on the "Services" button in the top left corner. Then, at the bottom, we'll see the "Storage" section, and after clicking on it, a menu will appear where we should select S3:
After that, we'll go to the menu, where you can see a short video guide from Amazon, which will tell you how to work with S3, as well as a lot of other information. You can review it if you want, but what we're interested in now is the "Create Bucket" button, which is shown in the screenshot below:
Now you need to configure your bucket. You can read about each of the settings yourself, or you can replicate my settings listed below.
Note
Note that I'm making the bucket public, meaning the media in this bucket will be accessible to everyone. Later, I'll configure it so that only GET requests are allowed, meaning users can only view and download media, not edit, create, or delete them.
If you've done everything correctly, you should see a picture like this in front of you:
Now let's configure our bucket so that users can only use GET requests, for example, to view the image on the screen or download it. To do this, we need to go to the bucket, navigate to the permissions section, and scroll down to the Bucket Policy section.
Then we need to add this code there:
This JSON is an Amazon S3 access policy that defines permissions for accessing objects in the S3 bucket. In AWS, these policies are used to manage access to resources in cloud services. In this case, the policy describes the following permissions:
- Version: This indicates the syntax version of the policy. "
2012-10-17
" is the latest and most widely used version of policies; - Statement: This is the main element of the policy, which contains an array of individual statements.
Each statement (in this case, one) contains:
- Effect: Determines whether the action is allowed or not. In this case, "
Allow
" means the action is permitted; - Principal: Specifies who receives the permission. Here, "
*
" means the permission is granted to all users; - Action: Specifies which action is allowed. "
s3:GetObject
" allows users to access (download) objects (files) in the S3 bucket; - Resource: Indicates the specific resource to which the permissions apply. "
arn:aws:s3:::codefinity-aws-course/*
" refers to all objects (indicated by the asterisk *) in the S3 bucket named "codefinity-aws-course".
Your permission file should look like this:
Note
Ignore any warnings from AWS because we are learning. We need the files in the bucket to be public so that we can visually see how the storage works through the code.
Great, we have successfully created a bucket and configured it for our needs. In the upcoming chapters, we will learn how to upload media files into it and use it in our code and applications.
Thanks for your feedback!