1 Answer
- Newest
- Most votes
- Most comments
0
Hello.
Is it possible for you to share the Lambda code?
As far as I can see in the error message, the ARN format is strange, so I think that the method of specifying the user pool ID is probably incorrect.
# Incorrect ARN
arn:aws:cognito-idp:eu-west-2:************:userpool/arn:aws:cognito-idp:eu-west-2:************:userpool/eu-west-2_*********
# Correct ARN
arn:aws:cognito-idp:eu-west-2:************:userpool/eu-west-2_*********
I tried the code below on my AWS account and it ran successfully.
Please make sure to include only the ID part, not the ARN, in "UserPoolId" as shown below.
import boto3
import botocore
def lambda_handler(event, context):
client = boto3.client('cognito-idp')
response = client.admin_get_user(
UserPoolId='ap-northeast-1_yyyyyy',
Username='11111111-1111-1111-1111-111111111111'
)
print(response)
Relevant content
asked a year ago

Thank you this helped. I was using an environment variable as the 'UserPoolId' and instead of using the actual ID I was using the arn as I must have been just going to quick through it.