Make public a folder in an S3 bucket

0

Hello, I am new to Amazon S3 and I plan to use it for my personal and work projects. Initially, I'm uploading work files that I need to share at the file or folder level. I need to generate a link (url) that can be seen by anyone who has the link. I have created a bucket to store all my files and I have them organized by folders. I already know how to give permission at the file (object) level and share the generated link, but I can't find a way to generate a folder link. I need to create a folder link where all the files inside the folder can be viewed and downloaded. How can this be done?

2 Answers
0
Accepted Answer

Generating a signed URL for a folder does not exist. There some S3 browser implementations out there that will list a folder. Example: Amazon S3 Browser Examples.

Also: AWS JavaScript S3 Explorer.

There is probably a way to do this with S3 Object Lambda.

profile pictureAWS
EXPERT
kentrad
answered a year ago
profile picture
EXPERT
reviewed 23 days ago
  • Thanks for answering. After searching for info and reading here and elsewhere, it's clear to me that sharing files (objects) in S3 has many advantages and can be done in many ways, but folders can't (at least the way we do it on platforms like Google Drive). But I've thought a bit further about what is the point of sharing a file/folder: if I want to share a folder that contains files, I can just zip the folder, upload the zip file, and generate a publicly accessible link as an S3 object. . But if what I want is to have a shared work folder with other people, I would have to create iam users that have some degree of access to my buckets.

  • You could also look at AWS Transfer Family and share a folder via SFTP. Your client then could use something like Filezilla to get the list of objects.

0
  1. CHECK AWS BLOCK PUBLIC ACCESS SETTING (DEFAULTS CHANGING IN 2023)
  2. CREATE A BUCKET POLICY ALLOWING OBJECTS TO BE ACCESSED
  3. RECOMMEND SHARING WITH PRE-SIGNED URLS FOR SECURITY

  1. CHECK AWS BLOCK PUBLIC ACCESS SETTING (DEFAULTS CHANGING IN 2023)

Amazon S3 block public access prevents the application of any settings that allow public access to data within S3 buckets. This section describes how to edit block public access settings for all the S3 buckets in your AWS account. For more information about blocking public access, see Blocking public access to your Amazon S3 storage. To edit block public access settings for all the S3 buckets in an AWS account

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
  2. Choose Block Public Access settings for this account.
  3. Choose Edit to change the block public access settings for all the buckets in your AWS account.
  4. Choose the settings that you want to change, and then choose Save changes.
  5. When you're asked for confirmation, enter confirm. Then choose Confirm to save your changes.

  1. CREATE A BUCKET POLICY ALLOWING OBJECTS TO BE ACCESSED

Grant public read access to the objects in a bucket

If your object ACLs grant public read access to all of the objects in your bucket, you can migrate these ACL permissions to a bucket policy.

This object ACL grants public read access to an object in a bucket:

{
    "Owner": {
        "DisplayName": "DOC-EXAMPLE-ACCOUNT-OWNER",
        "ID": "852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID"
    },
    "Grants": [
        {
            "Grantee": {
                "DisplayName": "DOC-EXAMPLE-ACCOUNT-OWNER",
                "ID": "852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID",
                "Type": "CanonicalUser"
            },
            "Permission": "FULL_CONTROL"
        },
        {
            "Grantee": {
                "Type": "Group",
                "URI": "http://acs.amazonaws.com/groups/global/AllUsers"
            },
            "Permission": "READ"
        }
    ]
}

https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-ownership-migrating-acls-prerequisites.html#object-ownership-public-read


  1. RECOMMEND SHARING WITH PRE-SIGNED URLS FOR SECURITY

You can use the AWS Management Console to generate a presigned URL for an object by following these steps.

In the Amazon S3 console, the maximum expiration time for a presigned URL is 12 hours from the time of creation. To generate a presigned URL using the AWS Management Console

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
  2. In the Buckets list, choose the name of the bucket that contains the object that you want a presigned URL for.
  3. In the Objects list, select the object that you want to create a presigned URL for.
  4. On the Actions menu, choose Share with a presigned URL.
  5. Specify how long you want the presigned URL to be valid.
  6. Choose Create presigned URL.
  7. When a confirmation appears, the URL is automatically copied to your clipboard. You will see a button to copy the presigned URL if you need to copy it again.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html

AWS
abemusa
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions