Getting 307’s from AWS S3 get_bucket commands

We had some old Python scripts we used to update Amazon S3 Buckets. Essentially, we were just uploading a bunch of files, and we would start the process with a get_bucket command.

Recently, our scripts blew up because our Python http library did not follow redirects, and the get_bucket call began returning 307’s.

Turns out we had to change our URL structure from the following:

https://bucket-name.s3.amazonaws.com

to

https://bucket-name.s3-us-west-2.amazonaws.com

For whatever reason, we had to start using the region name. I’m not sure if this is because we created a new bucket in a different way, but adding the region works.