0

I am trying to connect to AWS S3 bucket from AWS lambda.

I am using aws-sdk-s3 gem.

My code working fine on local machine. I was able to upload files to S3. But the same code giving timeout on lambda.

def client
  Aws::S3::Client.new({
    region: 'ap-south-1',
    credentials: Aws::Credentials.new(
      '',
      ''
    )
  })
end

def resource
  Aws::S3::Resource.new(client: client)
end

def bucket
  resource.bucket(bucket_name)
end

Should I do something more to make this code run on lambda?

Avinash142857
  • 129
  • 2
  • 13
  • Timeouts are usually due to network misconfiguration. Is your Lambda function running in a VPC? – Mark B Jan 10 '19 at 13:55

1 Answers1

0

I think the problem was gem aws-sdk-s3 gem wasn't installed on Lambda. Check it out: https://docs.aws.amazon.com/lambda/latest/dg/ruby-package.html

William Tran
  • 269
  • 1
  • 4