1
votes

I followed Amazon's tutorials on creating a HelloWorld lambda function in the Sydney region. It worked on the AWS console.

enter image description here

Then I tried to do it on the command line:

aws lambda invoke --invocation-type RequestResponse --function-name HelloWorld --region Sydney --payload '{"key1":"value1", "key2":"value2", "key3":"value3"}' outputfile.txt

Error:

Could not connect to the endpoint URL: "https://lambda.Sydney.amazonaws.com/2015-03-31/functions/HelloWorld/invocations"

I think my security keys are working because the the following command for listing my S3 buckets worked:

aws s3api list-buckets # Worked, so the security keys should work

1

1 Answers

2
votes

Based on the CLI command you issued to invoke the Lambda function, it seems like the issue lies in the region parameter.

Instead of the region parameter value "Sydney", replace it with "ap-southeast-2" which is the regional code for Asia Pacific (Sydney).