How to get URLs of S3 objects with no expiry date and with public access?

0

I tried some thing :

  1. Block all public access: off
  2.     {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "************/*"
        }```
    

but I'm getting a warning that Publicly accessible with a red color box under my bucket name. Should I worry about that?

OR is there any way to acess some thing like pass /appID to access private objects like: https://bucket.s3.us-north-8.amazonaws.com/img.png/appID

Finally my need is to get URLs of objects that I will hard code in my post model some thing like below: URL attribute will be a string:

type Post @model{
  id: ID!
  title: String!
  fileURL: https://bucket.s3.us-north-8.amazonaws.com/img.png
}

now in future I can't change the URL attribute. So I need a without expire date secure file access

1개 답변
0
수락된 답변

Best practice is to have no publicly-accessible objects. All the "Block Public Access" settings should be on and you should not have any "Publicly accessible" warnings.

If you need to allow people access to objects from their web browser, the two secure options are:

  1. If the objects are assets for a public website, make the bucket a CloudFront origin. Don't use S3's built-in static website hosting (URLs like http://<bucket-name>.s3-website-<region>.amazonaws.com or http://<bucket-name>.s3-website.<region>.amazonaws.com) as it doesn't support http.
  2. If the objects are private then your app should vend presigned URLs providing secure temporary access.

Your URL "https://bucket.s3.us-north-8.amazonaws.com/img.png" looks more like an S3 REST API URL, which would be used from an application either directly or more typically via an API package such as Boto3 for Python. In this case your application would get secure access to S3 objects with IAM credentials.

전문가
답변함 일 년 전
  • But they mentioned that Amplify.Storage.GetURL is only to download image I want all user can acess my objects. just like other app even if you not loggged in you can access photos ex: twitter, instagram

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠