Skip to content

Commit

Permalink
Merge pull request #2 from TUS-OSK/develop
Browse files Browse the repository at this point in the history
add lambda function add_user_config.py
  • Loading branch information
qq8244353 authored Apr 28, 2024
2 parents db59823 + c3c9c67 commit 7b992bb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lambda/add_user_cognito.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import boto3
import os
import json

def lambda_handler(event, context):
try:
cognito = boto3.client('cognito-idp')
body = json.loads(event['body'])
print(body)
username = body['username']
password = body['password']
userPoolId = os.environ['userPoolId']
response = cognito.admin_create_user(
UserPoolId = userPoolId,
Username = username,
TemporaryPassword = password,
)
print(response)
return {
'statusCode': 200,
}
except Exception as e:
print(e)
return {
'statusCode': 400,
}

0 comments on commit 7b992bb

Please sign in to comment.