AWS S3 Usage Summary

Source: Internet
Author: User
Tags hosting

Use scenario one: Store pictures of the site and be accessible to anyone

1. Create a bucket with the same name as the domain name you want to bind.

For example, the root domain name is mysite.com, want to put all the pictures under pic.mysite.com, access time with pic.mysite.com/a.jpg can directly access, then the bucket name should be set to pic.mysite.com

This time you can upload files in the console, of course, do the actual application of the need to use his SDK to write programs to achieve the upload function.

We upload a a.jpg, the right side of the properties inside gives a link "https://s3-xxx.amazonaws.com/pic.mysite.com/a.jpg", XXX will be based on your S3

In the region and different, click into is inaccessible, will prompt no permissions.

2. Set the bucket permissions.

Click Edit Bucket policy Inside Properties > Permissions, which will have policy generator guide you how to write policy.

Here we need to allow anyone to access the image stored in the bucket, so set the GetObject permissions to everyone.

{    "Version": "2012-10-17",    "Id": "Policy1434523265640",    "Statement": [        {             "Sid": "Stmt1434523262292",            "Effect": "Allow",            "Principal": "*",             "Action": "S3:getobject",            "Resource": "ARN:AWS:S3:::p ic.mysite.com/*"        }    ]}

This time to visit the front of the https://s3-xxx.amazonaws.com/pic.mysite.com/a.jpg, you can open it smoothly.

3. Set the domain name.

In fact http://pic.mysite.com.s3-xxx.amazonaws.com/a.jpg this link can also open the above picture, so just give pic.mysite.com set an alias CNAME " Pic.mysite.com.s3-xxx.amazonaws.com "is done.

Use Scenario two: hosting a static web site with S3

You can refer to this document:

Https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html

AWS S3 Usage Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.