Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I generate an S3 signed URL for a custom domain mapped via CNAME? #1228

Closed
crowdwave opened this issue Aug 16, 2017 · 3 comments
Closed
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. question

Comments

@crowdwave
Copy link

This issue explains precisely how to do it for JavaScript, but how to do it in Python/boto3?

aws/aws-sdk-js#891

I can't find any documentation that explains how to do what the JavaScript SDK does.

thanks

@joguSD joguSD added question closing-soon This issue will automatically close in 4 days unless further comments are made. labels Aug 17, 2017
@joguSD
Copy link
Contributor

joguSD commented Aug 17, 2017

I think you should be able to do this by setting the endpoint_url when creating a client to your domain. You'll also need to add a config for S3 by passing config=Config(s3={'addressing_style': 'path'})

import boto3
from botocore.client import Config

s3 = boto3.client('s3', endpoint_url='https://yoururl.com', config=Config(s3={'addressing_style': 'path'}))
url = s3.generate_presigned_url(ClientMethod='get_object', Params={'Bucket':'bucket', 'Key':'key'})

@crowdwave
Copy link
Author

Thanks for this answer which is correct, but in the end I had to go for a solution implementing CloudFront private content because you can only do HTTP if you get signed URLs for S3, not hTTPS.

@joguSD
Copy link
Contributor

joguSD commented Aug 18, 2017

Good catch on the HTTP(S) thing. I'm glad you got something working for your use case!

@joguSD joguSD closed this as completed Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. question
Projects
None yet
Development

No branches or pull requests

2 participants