Skip to content
Advertisement

Override S3 endpoint using Boto3 configuration file

OVERVIEW:

I’m trying to override certain variables in boto3 using the configuration file (~/aws/confg). In my use case I want to use fakes3 service and send S3 requests to the localhost.

EXAMPLE:

In boto (not boto3), I can create a config in ~/.boto similar to this one:

JavaScript

And the client can successfully pick up desired changes and instead of sending traffic to the real S3 service, it will send it to the localhost.

JavaScript

WHAT I TRIED:

I’m trying to achieve a similar result using boto3 library. By looking at the source code I found that I can use ~/aws/config location. I’ve also found an example config in unittests folder of botocore.

I tried to modify the config to achieve the desired behaviour. But unfortunately, it doesn’t work.

Here is the config:

JavaScript

QUESTION:

  1. How to overwrite clients variables using config file?
  2. Where can I find a complete list of allowed variables for the configuration?

Advertisement

Answer

You cannot set host in config file, however you can override it from your code with boto3.

JavaScript

Then you can interact as usual.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement