我尝试将变量account_id
传递给lambda函数内的shell脚本,此lambda将在该帐户的示例上运行该脚本
import sys
import logging
import datetime
import boto3
import botocore
import time
import json
from os import getenv
region = 'ap-southeast-2'
boto3.setup_default_session(region_name=region)
account_id = 123454
def handler(event, context):
client = boto3.client('ssm')
instance_name_list=\[12345678890,0000000000\]
if instance_name_list:
try:
response = client.send_command(
Targets=\[
{
'Key': 'InstanceIds',
'Values': instance_name_list
},
\],
DocumentName='AWS-RunShellScript',
Parameters={
'commands': \[
# shell command
'echo {account_ID}',
]
}
)
实现这一目标的正确途径是什么?
1条答案
按热度按时间7cjasjjr1#
你只需要...