LoginSignup
0
0

More than 3 years have passed since last update.

AWS SDKの戻り値をDynamoDBに格納する

Posted at
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)
})

AWS SDKの戻り値は(ほぼ全て?)Struct型なので、そのままではテーブルに格納できません。ハッシュ化し、さらにハッシュのキーと値を文字列化することで格納できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0