#パラメータの作成
パラメータの作成ボタンからパラメータを2つ作成します。
今回サンプルとして作ったパラメータの値は、テキスト型の架空のURLです。 
#Lambdaの作成
①関数名とランタイムだけ変更し関数を作成します。
②設定タブ→アクセス権限→ロール名をクリックします。 
③ポリシーをアタッチしますボタンを押します。 
④ポリシーの作成ボタンを押します。 
⑤JSONタブを押下し下記のコードに変更し、次のステップボタンからそのまま完了まで進みます。
policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ssm:GetParameters"
],
"Resource": "*"
}
]
}
⑥先ほどの③のロール画面に戻り、再びポリシーをアタッチしますボタンを押します。 
⑦先ほどの⑤で作成したポリシー名を検索し、チェックを付けポリシーのアタッチボタンを押します。 
⑧関数の画面に戻り、コードを修正します。
lambda_function.py
import json
import boto3
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_ssm_params(*keys, region='ap-northeast-1'):
result = {}
ssm = boto3.client('ssm', region)
response = ssm.get_parameters(
Names=keys,
WithDecryption=True,
)
for p in response['Parameters']:
result[p['Name']] = p['Value']
return result
def lambda_handler(event, context):
parameters = get_ssm_params('sample-url', 'sample-url2')
logger.info(parameters['sample-url'])
logger.info(parameters['sample-url2'])
⑨deployボタンを押してtestボタンを押すと、logでパラメータの値が取れているのが確認できます。 