Yasith Prabuddhaka
Yasith Prabuddhaka

Reputation: 927

How to use awscli inside ruby script?

I have a awscli command to upload content to s3 bucket. I need to run this command on a ruby script. The command works when executed in terminal. I tried using several methods like backticks and Kernel#system.

value = `aws s3 cp #{published_files} s3://example_bucket/#{meeting_id} --recursive --region us-west-2`

But none of them seem to execute the task. Can anyone suggest any way? It would be of great help

Upvotes: 5

Views: 1267

Answers (1)

Banjo Obayomi
Banjo Obayomi

Reputation: 1690

Use the sdk instead as it has native support for using s3 https://github.com/aws/aws-sdk-ruby

The API docs are listed here https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3.html

Upvotes: 1

Related Questions