Having issue with aws-sdk

Hello
Im, having issues using aws-sdk, Im new to ruby and also need some debug assistance.
Im trying to send sms notifications over AWS sns topic/subscription, Im using example from AWS documentation
but have no luck authenticating from within ruby script.

require ‘aws-sdk-sns’
require ‘aws-sdk-sms’
require ‘yaml’
require ‘aws-sdk-v1’
require ‘aws-sdk-configservice’
require ‘json’

creds = JSON.load(File.read(‘secrets.json’))
Aws.config[:credentials] = Aws::Credentials.new(creds[‘AccessKeyId’], creds[‘SecretAccessKey’])
topic.publish({
message: ‘Hello From Sensu!’
})

This does not work either.

AWS.config(access_key_id: ‘XXXXX’, secret_access_key: ‘XXXXXX’, region: ‘us-east-1’)

The code above does not work, nor even if I hardcode the credential, with put I can see creds has the values,
do not know how to put AccessKeyId or SecretAccessKey, they seems to be empty ,Im always getting this error

/usr/local/share/gems/gems/aws-sdk-core-3.44.1/lib/aws-sdk-core/plugins/signature_v4.rb:72:in `sign_request’: unable to sign request without credentials set (Aws::Errors::MissingCredentialsError)

Secrets file

{
“AccessKeyId”: “XXXXXX”,
“SecretAccessKey”: “XXXXX”
}

Creds content

{“AccessKeyId”=>“XXXXXX”, “SecretAccessKey”=>“XXXX”}

The only way to make it work is if I export the variables from bash.

I found how to echo the variable and I can see it has this content, is it seems the secret key is missing.

puts Aws.config.inspect
{:credentials=>#<Aws::Credentials access_key_id=“XXXXXXX”>}

Thanks in advance
Regards

I tried to inject your code myself using my AWS settings and it worked for me.