LoginSignup
1
3

More than 3 years have passed since last update.

lambda内でパラメータストアから値を取得する方法(python使用)

Last updated at Posted at 2020-02-18

概要

AWSのlambdaでパラメータストアの値を取得する方法をまとめる。

実際のコード

get
# 1. boto3をインポート
import boto3

ssm = boto3.client('ssm')
# 2. get_parameterメソッドでパラメータを取得
response = ssm.get_parameter(

# 3. パラストに登録されているキー名を設定
            Name = '/add/company-codes',
# 4. 値のみ取得したい場合はWithDecryption = False
   # 全ての情報を取得したい場合はWithDecryption = True
            WithDecryption=False
        )
value = response['Parameter']['Value']

boto3で使用できるメソッドについて

ここにいくつかのメソッドが載っています↓
(上で使用しているget_parameterも)

Boto 3 Documentation

1
3
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
1
3