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

Overriding Service Endpoints (v1 to v2) #1090

Closed
revett opened this issue Feb 9, 2016 · 1 comment
Closed

Overriding Service Endpoints (v1 to v2) #1090

revett opened this issue Feb 9, 2016 · 1 comment
Assignees
Labels
guidance Question that needs advice or information.

Comments

@revett
Copy link

revett commented Feb 9, 2016

Problem

In v1 you were able to override the global endpoint and port for a service from the default config options. Example:

AWS.config(:s3_endpoint => "my.example.endpoint")
AWS.config(:s3_port => 316)

Is this possible in v2? Or do you have to do override it when you create the client for a particular service?

@awood45
Copy link
Member

awood45 commented Feb 9, 2016

You can do this, the semantics are slightly different. The concept to keep in mind is that we will resolve configuration in roughly the following order:

  1. Locally supplied configuration at client creation time.
  2. Globally defined configuration, scoped to the service.
  3. Globally defined configuration.
  4. Default values.

Or, for a contrived code example:

client = Aws::S3::Client.new(region: "us-east-1")
client.config.endpoint # => #<URI::HTTPS https://s3.amazonaws.com>

Aws.config[:s3] = { endpoint: "https://bar.foo" }
Aws.config[:endpoint] = "https://foo.bar"

ec2 = Aws::EC2::Client.new(region: "us-east-1")
ec2.config.endpoint # => #<URI::HTTPS https://foo.bar>

s3 = Aws::S3::Client.new(region: "us-east-1")
s3.config.endpoint # => #<URI::HTTPS https://bar.foo>

s3_custom = Aws::S3::Client.new(region: "us-east-1", endpoint: "https://my.example.endpoint")
s3_custom.config.endpoint # => #<URI::HTTPS https://my.example.endpoint>

@awood45 awood45 closed this as completed Feb 9, 2016
@awood45 awood45 self-assigned this Feb 9, 2016
@diehlaws diehlaws added guidance Question that needs advice or information. and removed question labels Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants