.. |
bin |
lib |
rails |
.yardopts |
LICENSE.txt |
README.md |
ca-bundle.crt |
endpoints.json |
The official AWS SDK for Ruby.
You can install the AWS SDK for Ruby with rubygems:
gem install aws-sdk
If you are using Bundler, we recommend that you express a major version dependency (aws-sdk follows semantic versioning):
gem 'aws-sdk', '~> 1.0'
If you are using a version of Ruby older than 1.9, you may encounter problems with Nokogiri. The authors dropped support for Ruby 1.8.x in Nokogiri 1.6. To use aws-sdk, you'll also have to install or specify a version of Nokogiri prior to 1.6, like this:
gem 'nokogiri', '~> 1.5.0'
You need to provide your AWS security credentials and choose a default region.
AWS.config(access_key_id: '...', secret_access_key: '...', region: 'us-west-2')
You can also specify these values via ENV
:
export AWS_ACCESS_KEY_ID='...'
export AWS_SECRET_ACCESS_KEY='...'
export AWS_REGION='us-west-2'
Each service provides a service interface and a client.
ec2 = AWS.ec2 #=> AWS::EC2
ec2.client #=> AWS::EC2::Client
The client provides one method for each API operation. The client methods accept a hash of request params and return a response with a hash of response data. The service interfaces provide a higher level abstration built using the client.
Example: list instance tags using a client
resp = ec2.client.describe_tags(filters: [{ name: "resource-id", values: ["i-12345678"] }])
resp[:tag_set].first
#=> {:resource_id=>"i-12345678", :resource_type=>"instance", :key=>"role", :value=>"web"}
Example: list instance tags using the AWS::EC2 higher level interface
ec2.instances['i-12345678'].tags.to_h
#=> {"role"=>"web"}
See the API Documentation for more examples.
The SDK currently supports the following services:
This SDK is distributed under the Apache License, Version 2.0.
Copyright 2012. Amazon Web Services, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.