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

Where to get the value of region and what is it? Give an example what is a region! #1246

Closed
thebravoman opened this issue Jul 19, 2016 · 3 comments · Fixed by #1250
Closed
Labels
guidance Question that needs advice or information.

Comments

@thebravoman
Copy link

thebravoman commented Jul 19, 2016

With this version the region is required.

If I use us-west-2a I get

[Aws::S3::Client 0 2.243104 3 retries] put_object(content_type:"image/png",acl:"public-read",bucket:"fllcasts-development",key:"schools/pictures/000/000/027/original/exit_rbp_exit.png",body:#<File:/tmp/023b288fd692b5b3b3fa532314682be420160719-28827-1ul6wyq.png (102088 bytes)>) Seahorse::Client::NetworkingError getaddrinfo: Name or service not known

   (39.8ms)  ROLLBACK
Completed 500 Internal Server Error in 2610ms (ActiveRecord: 42.6ms)

Seahorse::Client::NetworkingError - getaddrinfo: Name or service not known:
  aws-sdk-core (2.3.21) lib/seahorse/client/networking_error.rb:7:in `initialize'
  aws-sdk-core (2.3.21) lib/seahorse/client/net_http/handler.rb:86:in `rescue in transmit'
  aws-sdk-core (2.3.21) lib/seahorse/client/net_http/handler.rb:68:in `transmit'
  aws-sdk-core (2.3.21) lib/seahorse/client/net_http/handler.rb:42:in `call'
  aws-sdk-core (2.3.21) lib/seahorse/client/plugins/content_length.rb:12:in `call'
  aws-sdk-core (2.3.21) lib/aws-sdk-core/plugins/s3_request_signer.rb:88:in `call'
  aws-sdk-core (2.3.21) lib/aws-sdk-core/plugins/s3_request_signer.rb:23:in `call'

If i use us-west-2 I get

[Aws::S3::Client 403 1.142556 0 retries] put_object(content_type:"image/png",acl:"public-read",bucket:"fllcasts-development",key:"schools/pictures/000/000/028/original/exit_rbp_exit.png",body:#<File:/tmp/023b288fd692b5b3b3fa532314682be420160719-28827-v9qfgu.png (102088 bytes)>) Aws::S3::Errors::AccessDenied Access Denied

   (42.3ms)  ROLLBACK
Completed 500 Internal Server Error in 1538ms (ActiveRecord: 120.7ms)

Aws::S3::Errors::AccessDenied - Access Denied:
  aws-sdk-core (2.3.21) lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
  aws-sdk-core (2.3.21) lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:in `call'
  aws-sdk-core (2.3.21) lib/aws-sdk-core/plugins/s3_accelerate.rb:33:in `call'
@Doug-AWS
Copy link
Contributor

Doug-AWS commented Jul 19, 2016

Try the code we include with the Aws.partition method, http://docs.aws.amazon.com/sdkforruby/api/Aws.html#partition-class_method.

Aws.partition('aws').regions.map(&:name)

It just returned:

us-east-1
us-west-1
us-west-2
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
sa-east-1
eu-west-1
eu-central-1

@awood45
Copy link
Member

awood45 commented Jul 19, 2016

You're seeing two different errors here.

  1. us-west-2a is not a valid region identifier.
  2. us-west-2 is a valid region, but if you're getting a Aws::S3::Errors::AccessDenied exception back from the service, it means you do not have permissions to perform that #put_object request. You should check the IAM role that you're using for your client to ensure it actually has permissions to make S3 calls and that it has permissions to write to that bucket.

@trevorrowe
Copy link
Member

I've submitted a pull-request that wraps the socket error you received above with a helpful error that indicates the likely cause and what possible regions are.

trevorrowe added a commit that referenced this issue Jul 21, 2016
awood45 added a commit that referenced this issue Jul 22, 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

Successfully merging a pull request may close this issue.

5 participants