require 'aws-sdk'
sts = Aws::STS::Client.new
ddb = Aws::DynamoDB::Client.new
ddb.put_item({
table_name: "anytable",
item: sts.get_caller_identity.to_h.transform_keys(&:to_s).transform_values(&:to_s)
})
Since the return value of AWS SDK is (almost all?) Struct type, it cannot be stored in the table as it is. It can be stored by hashing and then stringifying the key and value of the hash.
Recommended Posts