【AWS】使用 AWS S3

Posted by 西维蜀黍 on 2020-09-05, Last Modified on 2022-07-08

How do I create an S3 Bucket?

https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-bucket.html

Using Amazon S3 block public access

https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html

How do I upload files and folders to an S3 bucket?

https://docs.aws.amazon.com/AmazonS3/latest/user-guide/upload-objects.html

Bucket Policy Examples

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. (For a list of permissions and the operations that they allow, see Amazon S3 Actions.) This permission allows anyone to read the object data, which is useful for when you configure your bucket as a website and want everyone to be able to read objects in the bucket. Before you use a bucket policy to grant read-only permission to an anonymous user, you must disable block public access settings for your bucket. For more information, see Setting permissions for website access.

{
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"PublicRead",
      "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject","s3:GetObjectVersion"],
      "Resource":["arn:aws:s3:::awsexamplebucket1/*"]
    }
  ]
}

https://docs.aws.amazon.com/en_us/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-6