wbingli / awscli-plugin-endpoint

An awscli plugin to configure service endpoint from aws configure file
Apache License 2.0
207 stars 23 forks source link

For other AWS SDK? #14

Closed ozbillwang closed 4 years ago

ozbillwang commented 4 years ago

I just realized this plugin only works with AWS command line.

When I test with aws sdk, for example, python boto3, it doesn't understand this plugin, any hints for me to make it work for aws sdk, such as python, node, java, etc, as well ?

Here is my test case:

https://github.com/aws/aws-cli/issues/1270#issuecomment-585489375

wbingli commented 4 years ago

This plugin is for aws-cli only. If you wanna to support such profile in SDK, quick idea would be parsing the AWS config file and configure the endpoint.

ozbillwang commented 4 years ago

@wbingli

Seems your codes are very simple, but I don't understand this part.

def awscli_initialize(cli):
    cli.register('top-level-args-parsed', set_endpoint_from_profile)
    cli.register('top-level-args-parsed', set_verify_from_profile)
    cli.register('top-level-args-parsed', set_ca_bundle_from_profile)

Could you please explain, why aws cli naturally read [plugins] in ~/.aws/config and get all endpoint_url for each service easily? Especially the funciton set_endpoint_from_profile

I'd like to do the same for boto3, any hints for me?

I got the same error after commented the part of [plugins] with aws cli commands.

$ cat ~/.aws/config
# [plugins]
# endpoint = awscli_plugin_endpoint

[profile localstack]
s3 =
    endpoint_url = http://localhost:4572

If I run aws s3 ls, got the exact same error.

$ aws s3 ls

An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.
ozbillwang commented 4 years ago

Got this

https://github.com/aws/aws-cli/issues/1261#issuecomment-89082634

Seems the plugin feature is naturallly supported by aws cli directly

Can't find the same in python boto3

bcouetil commented 1 year ago

Hello, did you find a solution to this ?