Wednesday, 3 July 2019

Retrieve Root & IAM Access Key of Amazon S3


How to Retrieve Root Access Keys of Amazon S3

Go to Amazon Web Services console and click on the name of your account (it is located in the top right corner of the console). Then, in the expanded drop-down list, select My Security Credentials.
Click the Continue to Security Credentials button.
Expand the Access Keys (Access Key ID and Secret Access Key) option. You will see the list of your active and deleted access keys.

Note: You cannot retrieve the existing secret key. You can see the secret key only once immediately after creating. So, in order to get a secret key, you will need to create a new one.
To generate new access keys, click the Create New Access Key button.

Click Show Access Key to have it displayed on the screen. Note, that you can download it to your machine as a file and open it whenever needed. To download it, just click the Download Key File button.

Note : If you do not write down the key or download the key file to your computer before you press "Close" or "Cancel" you will not be able to retrieve the secret key in future. Then you'll have to delete the keys which you created and start to create new keys.

How to Retrieve IAM Access Keys of Amazon S3

Go to Amazon Web Services console and click on the name of your account (it is located in the top right corner of the console). Then, in the expanded drop-down list, select My Security Credentials.
Click the Get Started with IAM Users button.
This will bring you to the IAM Dashboard where you can manage IAM users and their permissions such as creating new IAM users, adding IAM users to the custom groups, granting them a certain level of permissions, etc.
 To review the IAM access keys, click on a particular user. 
Under Security Credentials, you will see a list of Access Keys for the IAM user.
Note: You cannot retrieve the existing secret keys. You can see the secret key only once immediately after creating. So, in order to get a secret key, you will need to create a new one.
Click Create Access Key to create a new key. The new access keys will be generated and displayed on the screen. 
Note : If you do not write down the key or download the key file to your computer before you press "Close" or "Cancel" you will not be able to retrieve the secret key in future. Then you'll have to delete the keys which you created start to create new keys.

Tuesday, 2 July 2019

Getting Started with Amazon S3

Getting Started with Amazon S3


  • It is storage for the internet. It's a simple storage service that offers software developers a highly-scalable, reliable, and low-latency data storage infrastructure at very low costs.
  • Also known as Key, Value store(Key, Value, Version ID, Metadata, ACL & Sub Resources).
  • Provides a simple web service interface that you can use to store and retrieve any amount of data at anytime, from anywhere on the web. It stores data as objects within buckets. An object consists of a file and optionally any metadata that describes that file.
  • Total volume of data & number of objects you can store are unlimited. Amazon S3 objects can range in size from a minimum 0 to 5 Terabytes. Multi-part upload also possible.
To use Amazon S3 we have to create/signup for Amazon S3.
Go to https://aws.amazon.com/s3/ and choose Get started with Amazon S3 and follow instructions available on screen.
Once your account got created you have to create Bucket using the AWS Management
Console. Every object in Amazon S3 is stored in a bucket. Before you can store data in Amazon S3, you must create a bucket.
To create an S3 bucket
  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
  2. Choose Create bucket.
  3. In the Bucket name field, type a unique DNS-compliant name for your new bucket.
  4. For Region, choose region where you want the bucket to reside.
  5. Choose Create.
You've created a bucket in Amazon S3.
Add an Object to a Bucket
In the Bucket name list, choose the name of the bucket that you want to upload your object to.
Choose Upload.

In the Upload dialog box, choose Add files to choose the file to upload. Choose a file to upload, and then choose Open(in dialog-box) in final screen click on upload button which will upload file into respective bucket.

View an Object
To download an object from a bucket
  1. In the Bucket name list, choose the name of the bucket that you created.
  2. In the Name list, select the check box next to the object that you uploaded, and then choose Download on the object overview panel.
Move an Object
To copy an object
  1. In the Bucket name list, choose the name of the bucket that you created.
  2. Choose Create Folder, type favorite-pics for the folder name, choose None for the encryption
  3. setting for the folder object and then choose Save.
  4. In the Name list, select the check box next to the object that you want to copy, choose More, and
  5. then choose Copy.
  6. In the Name list, choose the name of the folder favorite-pics.
  7. Choose More, and then choose Paste.
  8. Choose Paste.
Delete an Object and Bucket
You can delete the objects individually. Or you can empty a bucket, which deletes all the objects in the bucket without deleting the bucket. You can also delete a bucket and all the objects contained in the bucket. However, if you want to continue to use the same bucket name, don't delete the bucket. We recommend that you empty the bucket and keep it. After a bucket is deleted, the name becomes available to reuse, but the name might not be available for you to reuse for various reasons.

To delete an object from a bucket
  1. In the Bucket name list, choose the name of the bucket that you want to delete an object from.
  2. In the Name list, select the check box next to the object that you want to delete, choose More, and then choose Delete.
  3. In the Delete objects dialog box, verify that the name of the object you selected for deletion is listed, and then choose Delete.
You can empty a bucket, which deletes all the objects in the bucket without deleting the bucket.
To empty a bucket
  1. In the Bucket name list, choose the bucket icon next to the name of the bucket that you want to empty and then choose Empty bucket.
  2. In the Empty bucket dialog box, type the name of the bucket for confirmation and then choose Confirm.
You can delete a bucket and all the objects contained in the bucket.
To delete a bucket
  1. In the Bucket name list, choose the bucket icon next to the name of the bucket that you want to delete and then choose Delete bucket.
  2. In the Delete bucket dialog box, type the name of the bucket for delete confirmation and then choose Confirm.
We will upload files into bucket or bucket/folder/file, if successful upload then status returned is HTTP200 code.

S3 Security
  1. Bucket Policies
  2. ACL - Drill down to object level access
S3 Encryption
  • In data transit - SSL/TLS
  • Data at rest :
          -SSE-S3 (Server Side Encryption AES-256 advance encryption method)
          -SSE-KMS (Server Side Encryption Key Management Service)
          -SSE-C (Server Side Encryption (Client side Encryption technique - client library such as Amazon S3 Encryption Client)    
Advantages to Amazon S3 
Amazon S3 is intentionally built with a minimal feature set that focuses on simplicity and robustness. Following are some of advantages of the Amazon S3 service: 
  • Create Buckets – Create and name a bucket that stores data. Buckets are the fundamental container in Amazon S3 for data storage. 
  • Store data in Buckets – Store an infinite amount of data in a bucket. Upload as many objects as you like into an Amazon S3 bucket. Each object can contain up to 5 TB of data. Each object is stored and retrieved using a unique developer-assigned key. 
  • Download data – Download your data or enable others to do so. Download your data any time you like or allow others to do the same. 
  • Permissions – Grant or deny access to others who want to upload or download data into your Amazon S3 bucket. Grant upload and download permissions to three types of users. Authentication mechanisms can help keep data secure from unauthorized access. 
  • Standard interfaces – Use standards-based REST and SOAP interfaces designed to work with any Internet-development toolkit.
Amazon S3 Concepts
Buckets : A bucket is a container for objects stored in Amazon S3. Every object is contained in a bucket
Objects : Objects are the fundamental entities stored in Amazon S3. Objects consist of object data and metadata. The data portion is opaque to Amazon S3. The metadata is a set of name-value pairs that describe the object.
Keys : A key is the unique identifier for an object within a bucket. Every object in a bucket has exactly one key. Because the combination of a bucket, key, and version ID uniquely identify each object.
Regions : You can choose the geographical region where Amazon S3 will store the buckets you create. You might choose a region to optimize latency, minimize costs, or address regulatory requirements. Objects stored in a region never leave the region unless you explicitly transfer them to another region.
Amazon S3 Data Consistency Model : 
Amazon S3 provides read-after-write consistency for PUTS of new objects in your S3 bucket in all regions with one caveat. The caveat is that if you make a HEAD or GET request to the key name (to find if the object exists) before creating the object, Amazon S3 provides eventual consistency for read-after-write. 
Amazon S3 offers eventual consistency for overwrite PUTS and DELETES in all regions. Updates to a single key are atomic. 
 Amazon S3 achieves high availability by replicating data across multiple servers within Amazon's data centers. If a PUT request is successful, your data is safely stored. However, information about the changes must replicate across Amazon S3, which can take some time, and so you might observe the following behaviors: 
  • A process writes a new object to Amazon S3 and immediately lists keys within its bucket. Until the change is fully propagated, the object might not appear in the list. 
  • A process replaces an existing object and immediately attempts to read it. Until the change is fully propagated, Amazon S3 might return the prior data. 
  • A process deletes an existing object and immediately attempts to read it. Until the deletion is fully propagated, Amazon S3 might return the deleted data. 
  • A process deletes an existing object and immediately lists keys within its bucket. Until the deletion is fully propagated, Amazon S3 might list the deleted object.
Note : Amazon S3 does not currently support Object Locking. If two PUT requests are simultaneously made to the same key, the request with the latest time stamp wins. If this is an issue, you will need to build an object-locking mechanism into your application. Updates are key-based; there is no way to make atomic updates across keys.
Bucket Policies
Bucket policies provide centralized access control to buckets and objects based on a variety of conditions,including Amazon S3 operations, requesters, resources, and aspects of the request (e.g., IP address). The policies are expressed in our access policy language and enable centralized management of permissions.
The permissions attached to a bucket apply to all of the objects in that bucket.
Individuals as well as companies can use bucket policies. When companies register with Amazon S3 they create an account. Thereafter, the company becomes synonymous with the account. Accounts are financially responsible for the Amazon resources they (and their employees) create. Accounts have the power to grant bucket policy permissions and assign employees permissions based on a variety of conditions. For example, an account could create a policy that gives a user write access:
• To a particular S3 bucket
• From an account's corporate network
An account can grant one user limited read and write access, but allow another to create and delete buckets as well. An account could allow several field offices to store their daily reports in a single bucket, allowing each office to write only to a certain set of names (e.g., "Nevada/*" or "Utah/*") and only from the office's IP address range.
Only the bucket owner is allowed to associate a policy with a bucket. Policies, written in the access policy
language, allow or deny requests based on:
  • Amazon S3 bucket operations (such as PUT ), and object operations (such as PUT Object, or GET Object)
  • Requester
  • Conditions specified in the policy
Set ACL Bucket Permissions?
To set ACL access permissions for an S3 bucket
1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the name of the bucket that you want to set permissions for.
3. Choose Permissions, and then choose Access Control List.
4. You can manage bucket access permissions for the following:
a. Access for your AWS accounted root user  
The owner refers to the AWS account root user, and not an AWS Identity and Access Management (IAM) user. 
To change the owner's bucket access permissions, under Access for your AWS accounted root user, choose Your AWS Account (owner).
Select the check boxes for the permissions that you want to change, and then choose Save.
b. Access for other AWS accounts
To grant permissions to an AWS user from a different AWS account, under Access for other AWS accounts, choose Add account. In the Enter an ID field, enter the canonical ID of the AWS user that you want to grant bucket permissions to. For information about finding a canonical ID, seeAWS Account Identifiers in the Amazon Web Services General Reference. You can add as many as 99 users.
Select the check boxes next to the permissions that you want to grant to the user, and then choose Save. To display information about the permissions, choose the Help icons
Warning
When you grant other AWS accounts access to your resources, be aware that the AWS accounts can delegate their permissions to users under their accounts. This is known as cross-account access.
c. Public access
To grant access to your bucket to the general public (everyone in the world), under Public access, choose Everyone. Granting public access permissions means that anyone in the world can access the bucket. Select the check boxes for the permissions that you want to grant, and
then choose Save.
To undo public access to your bucket, under Public access, choose Everyone. Clear all the permissions check boxes, and then choose Save.
Warning
Use caution when granting the Everyone group public access to your S3 bucket. When you grant access to this group, anyone in the world can access your bucket. We highly recommend that you never grant any kind of public write access to your S3 bucket.
S3 log delivery group
To grant access to Amazon S3 to write server access logs to the bucket, under S3 log delivery group, choose Log Delivery.
If a bucket is set up as the target bucket to receive access logs, the bucket permissions must allow the Log Delivery group write access to the bucket. When you enable server access logging on a bucket, the Amazon S3 console grants write access to the Log Delivery group for the target bucket that you choose to receive the logs.

To create or edit a bucket policy
1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the name of the bucket that you want to create a bucket policy for or whose bucket policy you want to edit.
3. Choose Permissions, and then choose Bucket Policy.

4. In the Bucket policy editor text box, type or copy and paste a new bucket policy, or edit an existing policy. The bucket policy is a JSON file. The text you type in the editor must be valid JSON.

5. Choose Save.
Note
Amazon S3 displays the Amazon Resource Name (ARN) for the bucket next to the Bucket
policy editor title. 
Allow Cross-Domain Resource Sharing with CORS?
CORS allows client web applications that are loaded in one domain to interact with resources in another domain. A CORS configuration is an XML document that defines rules that identify the origins that you will allow to access your bucket, the operations (HTTP methods) supported for each origin, and other operation specific information.
To add a CORS configuration to an S3 bucket
1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the name of the bucket that you want to create a bucket policy for.
3. Choose Permissions, and then choose CORS configuration.

4. In the CORS configuration editor text box, type or copy and paste a new CORS configuration, or edit an existing configuration. The CORS configuration is an XML file. The text that you type in the editor must be valid XML.

5. Choose Save.
Note
Amazon S3 displays the Amazon Resource Name (ARN) for the bucket next to the CORS configuration editor title.
Viewing Access Status 
The list buckets view shows whether your bucket is publicly accessible. Amazon S3 labels the permissions for a bucket as follows: 
• Public – Everyone has access to one or more of the following: List objects, Write objects, Read and write permissions. 
• Objects can be public – The bucket is not public, but anyone with the appropriate permissions can grant public access to objects. 
• Buckets and objects not public – The bucket and objects do not have any public access. 
• Only authorized users of this account – Access is isolated to IAM users and roles in this account and AWS service principals because there is a policy that grants public access. 
There are three highly durable storage class :
  1. Amazon S3 standard for general-purpose storage of frequently accessed data.
  2. Amazon S3 standard-Infrequent Access for long-lived but less frequently accessed data.
  3. Amazon Glacier for long-term archive.
Reduced Repository Storage(RSS)
It is an Amazon S3 storage option that enables customers to reduce their code by storing non-critical reproducible data at lower levels of redundancy than Amazon S3's standard storage.

Retrieve Root & IAM Access Key of Amazon S3

How to Retrieve Root Access Keys of Amazon S3 Go to Amazon Web Services console and click on the name of your account (it is located ...