Questions tagged [aws-sdk-ruby]

The official AWS SDK for Ruby is a gem used to access many AWS services such as S3, EC2, DynamoDB, Glacier, SQS, SimpleDB, Elastic Beanstalk and more.

The AWS SDK for Ruby is an official gem provided to facilitate interactions with numerous AWS services. For version 3, services have been modularized into individual gems that can be imported, such as aws-sdk-s3 or aws-sdk-ec2. Alternatively, the aws-sdk gem will import every available service gem.

This tag can be used for questions regarding either the general aws-sdk gem, or any of its supported services gems.

Resources:

101 questions
42
votes
7 answers

Error "uninitialized constant AWS (NameError)"

It is saying AWS is uninitialized. I am usign the aws-sdk-core gem. I tried using the aws-sdk gem instead, and the problem was still there. This is the initializers/aws.rb file: AWS.config(:access_key_id => ENV['AWS_ACCESS_KEY_ID'], …
21
votes
2 answers

Recommended way to generate a presigned url to S3 Bucket in Ruby

I am trying to generate a pre-signed url on my Rails server to send to the browser, so that the browser can upload to S3. It seems like aws-sdk-s3 is the gem to use going forward. But unfortunately, I haven't come across documentation for the gem…
geoboy
  • 1,172
  • 1
  • 11
  • 25
9
votes
2 answers

Ruby: S3 access with AWS instance profile

I have a ec2 instance which has a profile attached. I can use awscli and it uploads to the bucket fine. root@ocr-sa-test:/# aws s3 ls s3://company-ocr-east/ PRE 7_day_expiry/ root@ocr-sa-test:/# touch…
Mike
  • 7,769
  • 13
  • 57
  • 81
6
votes
1 answer

Stubbing AWS S3 object request

I'm trying to stub out a request to get an object in a AWS bucket. I've read their docs about stubbing requests and was only able to stub out a bucket, not an object. Here are somethings I've tried: Stubbing through the AWS config: Aws.config[:s3] =…
Ccyan
  • 1,057
  • 12
  • 32
5
votes
2 answers

Rails 6 - Allow/Disallow file download as per user role for files on AWS S3

I have a Rails 6 app, where registered users(Owner) can upload files - images/videos on S3 and then the the owner can provide access to other users(invitations) to view their uploaded content. Is there a way I can restrict file access so that only…
Milind
  • 4,535
  • 2
  • 26
  • 58
5
votes
1 answer

Using AWS Glue Schema Registry for Node.js or Ruby on Rails

Looking at the documentation for AWS Glue Schema Registry it seems like you can't use it for Node.js or Ruby on Rails: The AWS Glue Schema Registry supports AVRO (v1.10.2) data format and Java language support, with other data formats and languages…
Sandip Subedi
  • 1,039
  • 1
  • 14
  • 34
5
votes
3 answers

File encoding issue when downloading file from AWS S3

I have a CSV file in AWS S3 that I'm trying to open in a local temp file. This is the code: s3 = Aws::S3::Resource.new bucket = s3.bucket({bucket name}) obj = bucket.object({object key}) temp = Tempfile.new('temp.csv') obj.get(response_target:…
kaydanzie
  • 386
  • 3
  • 7
  • 17
5
votes
1 answer

AWS Cognito + RubyOnRails get user info on the backend. Aws::CognitoIdentityProvider::Errors::NotAuthorizedException

I should integrate cognito + ruby on rails. My user logined with cognito default login page and redirected with url params to my…
4
votes
0 answers

"Tried to create Proc object without a block" error when running AWS SDK with ruby 3.1

I'm getting the error "tried to create Proc object without a block (ArgumentError)" from the AWS SDK Core gem when trying to run a rails app after upgrading ruby to 3.1.1. This surprises me since it looks like the library is being maintained / used…
Jared Sohn
  • 443
  • 5
  • 17
4
votes
0 answers

S3 copy_object between regions in ruby

How to coppy files between buckets in diffrent regions in AWS S3 using ruby aws-sdk-s3 gem? Buckets are in regions: 'eu-central-1' (target_bucket) and 'eu-west-1' (source_bucket). I want to make copy of s3://source_bucket/name_base.checksum to…
Daaniell
  • 41
  • 1
4
votes
1 answer

In Memory Transform Stream in Ruby?

Node.js developer here who has to work with Ruby, so I'm pretty new to a lot of concepts in Ruby and could use some help. My use case is that I have to download very large newline delimited JSON files from S3, transform the data, and put it back to…
aloisbarreras
  • 557
  • 6
  • 14
4
votes
2 answers

How do I mock AWS SDK (v2) with rspec?

I have a class which reads/processes messages from an SQS queue using the aws-sdk-rails gem (which is a wrapper on aws-sdk-ruby v2). How do I mock the AWS calls so I can test my code without hitting the external services? communicator.rb: class…
Pete
  • 10,310
  • 7
  • 53
  • 59
3
votes
2 answers

Rails keeps asking for AWS credentials for MySQL storage

I’m trying out Sharetribe Community Edition on a Debian 10 server (not AWS) following these instructions: https://github.com/sharetribe/sharetribe#installation I am stuck on step 7 with the following…
3
votes
1 answer

Getting the event body attributes in Ruby with AWS Lambda

So I'm new to ruby and I have a simple REST API. The post request looks like this: POST /endpoint, { 'message': 1 } My lambda handler looks like this: def run(event:, context:) puts "#{event['body']}" # prints the request body end I'm…
edmamerto
  • 7,605
  • 11
  • 42
  • 66
3
votes
1 answer

How to configure Rails 5, paperclip 5, aws-sdk 2 on heroku properly?

I deployed Rails 5 app local with paperclip attachments: all was working fine. Only on heroku I need AWS s3 and it does not work with Rails 5.0.1/paperclip 5.1.0/aws-sdk 2.7.3. Has anybody a working configuration for storing attachments on s3? This…
1
2 3 4 5 6 7