in source/CRRdeployagent/CRRdeployagent.py [0:0]
def create_agent(event, context):
# print(json.dumps(event))
# For manager/agent account you will receive:
# - Topic
# - CRRQueueArn
# - MyAccountId
# For agent-only (remote) account you will receive:
# - MyAccountId
# - CRRMonitorAccount
#
print(json.dumps(event))
monitor_account = ''
topic_name = ''
queue_arn = ''
agent_accounts = []
if 'Topic' in event["ResourceProperties"]:
topic_name = event["ResourceProperties"]["Topic"] # SNS topic
if 'CRRQueueArn' in event["ResourceProperties"]:
queue_arn = event["ResourceProperties"]["CRRQueueArn"]
if 'CRRMonitorAccount' in event["ResourceProperties"]:
monitor_account = event["ResourceProperties"]["CRRMonitorAccount"]
if 'AgentAccounts' in event["ResourceProperties"]:
agent_accounts = event["ResourceProperties"]["AgentAccounts"]
# Default value for returning resourceid
physical_resource_id = {'PhysicalResourceId': 'CRRMonitorAgent-Deployed'}
# Configure each region for monitoring based on what we found.
for region in REGIONSEL:
print('Deploying in ' + region)
agent_creator(region, topic_name, queue_arn, monitor_account, agent_accounts)
return physical_resource_id