After updating gem Version 1.50 to 2.0 of aws then i facing problem to download the data from S3 Bucket on aws server (Amazon web Services).
After Updating gem we first change the old Configuration and minor syntactical changes.
like Version 2 uses the
And configuration of region is like this.
For S3 bucket fetching from aws server we use this..
For more important method please goto Amazon (aws Documentation).
Aws::Errors::MissingRegionError: missing region; use :region option or export region name to ENV['AWS_REGION']
AWS.config(access_key_id: '...', secret_access_key: '...', region: 'us-west-2')
On last version of aws we smply use s3= AWS::S3.new and fetching the bucket by using s3.buckets['bucketName'] After Updating gem we first change the old Configuration and minor syntactical changes.
like Version 2 uses the
Aws
namespace, not AWS
.And configuration of region is like this.
Aws.config[:region] = 'Region'
Aws.config[:credentials] =
Aws::Credentials.new(creds['AccessKeyId'], creds['SecretAccessKey'])
For S3 bucket fetching from aws server we use this..
s3 = Aws::S3::Client.new(credentials: credentials)
s3.get_object(bucket: 'Name', Key: 'objectKey')
resp = s3.list_objects(bucket: 'aws-sdk-core', max_keys: 2)
resp.contents.each do |object|
puts "#{object.key} => #{object.etag}"
end
This method is use to get key by bucket Name.
get_object method simply return the method of s3 bucket in Paging Responses.
For more important method please goto Amazon (aws Documentation).