Amazon S3 hardcode my cart url

I use Amazon S3 to store images for my web and iOS apps.

I wonder if I can safely hardcode my bucket of URLs when retrieving images? So I do not need to make another API call just to get my URL.

For example, hardcoding is in my application code:

https://s3.eu-central-1.amazonaws.com/mybucket/images/{some_var} 
+6
source share
2 answers

Just add - you can do this in two ways.

  • Shared hosting URL (bucket name is part of the domain name in the URL)
    • http://bucket-name.s3.amazonaws.com/<file-name>
    • http://bucket-name.s3-aws-region.amazonaws.com/<file-name>
  • A path-style URL (the bucket name is not part of the domain, and the endpoint you are using must match the area the bucket is in [except N. Virginia]).
    • http://region-name.amazonaws.com/bucket-name/<file-name>

Detailed description:
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html

0
source

Yes, it should be safe.

If that changed, it would break ... so much. The service name, region, AWS domain is unlikely to change. Other parts of the URL are under your control.

+3
source

All Articles