[AWS query-instance_method docs](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/DynamoDB/Client/V20120810.html#query-instance_method) ```sh export AWS_ACCESS_KEY_ID=‘XXXX’ export AWS_SECRET_ACCESS_KEY=‘XXXX’ ``` ```rb # ENV['AWS_ACCESS_KEY_ID'] # ENV['AWS_SECRET_ACCESS_KEY'] require 'aws-sdk' dynamo_db = AWS::DynamoDB.new # Create table foobar = dynamo_db.tables.create( 'foobar', 10, 5, :hash_key => { :component_id => :string }, :range_key => { :opts_hash => :string } ) foobar.status # => :creating foobar.status # => :active (takes ~15 seconds) foobar.hash_key # => foobar.range_key # => # Get table dynamo_db.tables['foobar'] # Create Item item1 = foobar.items.create( :component_id => '1', :opts_hash => 'abc', :s3_location => 'foo/bar/baz' ) # => # Retrieve Items foobar.items.each { |item| puts item.attributes.to_h } # => {"s3_location"=>"foo/bar/baz", "component_id"=>"1", "opts_hash"=>"def"} # Delete Tables dynamo_db.tables.each {|x| if x.name == foobar then x.delete end } # Query Tables client = AWS::DynamoDB::Client::V20120810.new client.query({ :table_name => 'foobar', :consistent_read => true, :select => 'SPECIFIC_ATTRIBUTES', :attributes_to_get => ['s3_location'], :key_conditions => { 'component_id' => { :comparison_operator => 'EQ', :attribute_value_list => [ { 's' => '1' } ], }, 'opts_hash' => { :comparison_operator => 'EQ', :attribute_value_list => [ { 's' => 'def' } ] } } }) # => {:member=>[{"s3_location"=>{:s=>"foo/bar/baz"}}], :count=>1} ```