Hi,
I have two boto3(python) script for creating Users in AWS AppStream 2.0 and Assigning user to existing AppStream Stack. Its working fine from command line like my local system. But now i trying to implement this both script as single function(Creating user and assigning user to existing stack) in Lambda function. Whenever i run my lambda function code, it execute first part only like - it can create user whereas cant associate to existing running stack. I knew, i formatted my code not well in lambda function, due to poor knowledge in python. I have shared my lambda function here. Kindly correct it and reply me asap.
Lambda function code - python3
#!/usr/bin/env python3
import botocore
import boto3
def lambda_handler(event, context):
client = boto3.client('appstream',aws_access_key_id='xxxxxx',aws_secret_access_key='yyyyyy')
session = boto3.Session(region_name='us-west-2')
response = client.create_user(
UserName='ram@example.com',
FirstName='Ram',
LastName='Nathan',
AuthenticationType='USERPOOL'
)
response = client.batch_associate_user_stack(
UserStackAssociations=[
{
'StackName': 'ss',
'UserName': 'ram@example.com',
'AuthenticationType': 'USERPOOL',
'SendEmailNotification': True
},
]
)
Below are logs
Execution result: succeeded
The area below shows the result returned by your function execution. Learn more about returning results from your function.
null
Kindly correct my code to create user in user pool and associate created user to running AppStream stacks. aws