首页 > 其他分享 >[1049] Configuring an S3 bucket with public access and enable public listing of all files

[1049] Configuring an S3 bucket with public access and enable public listing of all files

时间:2024-08-27 14:16:39浏览次数:4  
标签:files enable s3 bucket your access S3 public

To configure an S3 bucket with public access and enable public listing of all files, follow these steps:

Step-by-Step Guide

  1. Open the S3 Console:

    • Sign in to the AWS Management Console and open the Amazon S3 console.
  2. Select Your Bucket:

    • Click on the name of the bucket you want to make public.
  3. Disable Block Public Access:

    • Go to the “Permissions” tab.
    • Click “Edit” under “Block public access (bucket settings)”.
    • Uncheck all the boxes to disable block public access.
    • Click “Save changes”.
  4. Set Bucket Policy for Public Read Access:

    • Scroll down to the “Bucket policy” section and click “Edit”.
    • Add the following policy to allow public read access to all objects in the bucket:
      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
              "s3:GetObject",
              "s3:ListBucket"
            ],
            "Resource": [
              "arn:aws:s3:::your-bucket-name",
              "arn:aws:s3:::your-bucket-name/*"
            ]
          }
        ]
      }
    • Replace your-bucket-name with the name of your bucket.
    • Click “Save changes”.
  5. Upload Files:

    • Go to the “Objects” tab and upload your files if you haven’t already.

Example

If your bucket is named example-bucket, the policy would look like this:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::example-bucket",
        "arn:aws:s3:::example-bucket/*"
      ]
    }
  ]
}

Verify Public Access

  • After configuring the policy, you can verify public access by clicking on the object URL in the S3 console. The URL should be in the format:
    http://example-bucket.s3.amazonaws.com/your-file-name

These steps will make all files in your S3 bucket publicly accessible and listable123.

Would you like help with anything else?


To access and list all files within a public S3 bucket, you can use several methods:

Using a Web Browser

  1. Open the S3 Bucket URL: If the bucket is configured for public access, you can access it via a URL like http://example-bucket.s3.amazonaws.com/.

  2. Browse the Files: If directory listing is enabled, you’ll see a list of files and folders. Click on any file to download or view it.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>05.png</Key>
<LastModified>2024-08-27T01:41:13.000Z</LastModified>
<ETag>"7c9370c975b23bb95e27768f752fc379"</ETag>
<Size>3880121</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>19.png</Key>
<LastModified>2024-08-22T04:06:37.000Z</LastModified>
<ETag>"6e94654212a0b0186e082448351c7b1f"</ETag>
<Size>3764950</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>error.html</Key>
<LastModified>2024-08-27T04:08:17.000Z</LastModified>
<ETag>"bc252341bb3343b66b0f9decf6d5495b"</ETag>
<Size>680</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>index.html</Key>
<LastModified>2024-08-27T04:13:00.000Z</LastModified>
<ETag>"cc0aad539c8757e4c22fe23d3283cb4f"</ETag>
<Size>811</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>test_geo_json.json</Key>
<LastModified>2024-08-27T04:36:05.000Z</LastModified>
<ETag>"4bcc06ea5e39e65469a34ef4cc7b49da"</ETag>
<Size>54156</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>time.json</Key>
<LastModified>2024-08-27T04:32:33.000Z</LastModified>
<ETag>"a90b0b59cbb2558ef2dfe1b3b8c46e89"</ETag>
<Size>36</Size>
<Owner>
<ID>e6aa9f7e4f9bd5e82c337931a56157c6959f8405c7a3380b4e399b6c14da975d</ID>
<DisplayName>gis</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>

 

标签:files,enable,s3,bucket,your,access,S3,public
From: https://www.cnblogs.com/alex-bn-lee/p/18382595

相关文章

  • 【Win 10/Win 11】【Foxmail】解决Foxmail邮件客户端安装在Windows系统下Program File
    虽然到目前(2024/08)Foxmail邮件客户端已经有一段时间没有更新了,但它仍不失为Windows操作系统下好用的邮件客户端之一。笔者在安装Foxmail时将默认路径设置为了D:\ProgramFiles\,而Windows10和Windows11对于分区根目录下ProgramFiles,ProgramFile(x86)等文件夹有特殊的权限限制,......
  • OpenCV(cv::FileStorage())
    目录1.功能2.方法和用法3.示例3.1写入数据3.2读取数据4.常见数据格式5.注意事项6.总结cv::FileStorage()是OpenCV提供的一个用于读写文件的类,主要用于读取和写入结构化数据(如XML、YAML或JSON文件)。它是用于在文件和内存之间存储和检索复杂数据结构的工具,例如矩......
  • IDEA中使用git合并分支的过程报错:cant checkout because of unmerged files
    使用idea的git插件控制代码分支合并时,由于操作不当,报错了,控制台报错如下:cantcheckoutbecauseofunmergedfiles,youhavetoresolveallmergeconflictsbeforecheckout.仔细回想报错的起因,经过大概是这样的:首先,远程仓库里面的代码版本是很老了,而本地的代码版......
  • SpringBoot文档之Profiles的阅读笔记
    ReferenceCoreFeaturesProfiles类似Maven的Profile特性,限定配置项取值的生效场景。在代码中,对于使用注解@Component、@Configuration、@ConfigurationProperties标记的类,可以增加@Profile,限定前述类的生效场景。类似如下样例代码,当启动时指定Profile为production时生......
  • IMEFILES.DLL文件丢失导致程序无法运行问题
    其实很多用户玩单机游戏或者安装软件的时候就出现过这种问题,如果是新手第一时间会认为是软件或游戏出错了,其实并不是这样,其主要原因就是你电脑系统的该dll文件丢失了或没有安装一些系统软件平台所需要的动态链接库,这时你可以下载这个IMEFILES.DLL文件(挑选合适的版本文件)把它......
  • Oracle 12c后enable_ddl_logging的日志位置变化
     Oracle12c后enable_ddl_logging的日志位置变化 先吐个槽,enable_ddl_logging功能是OracleChangeManagementPack的一部分,需要作为单独的许可证购买,要单独花钱......开启enable_ddl_logging功能,在11g中,ddl操作将以XML格式被记录在ADR_HOME/trade/alert_<SID>.log文件中......
  • Paths和Files
    Paths类Paths类主要用于操作文件和目录路径。它提供了一些静态方法,用于创建java.nio.file.Path实例,代表文件系统中的路径。//创建一个Path实例,表示当前目录下的一个文件Pathpath=Paths.get("example.txt");//创建一个绝对路径PathabsolutePath=Paths.get("/home/u......
  • 根据银灿IS903的CD-ROM盘符打开光盘文件索引数据库Index-Your-Files-2024年8月15日
    根据银灿IS903的CD-ROM盘符打开光盘文件索引数据库Index-Your-Files-2024年8月15日   =====段落分隔符=====Config-7z-SFX-Builder-v2.5.0.5;!@Install@!UTF-8!InstallPath="C:\\APP"OverwriteMode="1+8"RunProgram="nowait:C:\\APP\\IYF\\Delphi7\\Proj......
  • 在 Ubuntu 上使用 bash 访问 Windows 的 Program Files (x86) 目录时,遇到 “未预期的
    ubuntu进入windowsProgramFiles(x86)目录时提示bash:未预期的符号“(”附近有语法错误 是因为目录名中包含了空格和特殊字符(如括号)。在 bash 中,处理这些字符时需要特别注意。以下是解决方法:使用引号:用引号将路径括起来,以处理目录中的空格和特殊......
  • vue 图片资源应该如何存放并引入(public、assets)?
    public放不会变动的文件(相当于vue-cli2.x中的static)public/目录下的文件并不会被Webpack处理:它们会直接被复制到最终的打包目录(默认是dist/static)下。必须使用绝对路径引用这些文件,这个取决于你vue.config.js中publicPath的配置,默认的是/。assets放可能会变动的文件assets目录......