If you follow the AWS documentation for signature v4 signing process, you know it requires you to going through alot of steps. π¨
Finally I found faraday_middleware-aws-sigv4 gem.
For me it's a live-saver. π
conn = Faraday.new(url: API_BASE_URL) do |faraday|
faraday.request :aws_signers_v4,
credentials: Aws::Credentials.new(response["access_key_id"], response["secret_key"], response["session_token"]),
service_name: 'execute-api',
region: 'us-east-1'
faraday.adapter Faraday.default_adapter
end
puts conn.headers
response = conn.post('/orders') do |req|
req.headers['Content-Type'] = 'application/json'
end
puts response.body
Top comments (0)