Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SNS error - Invalid parameter while publishing message using aws-cli

I am working with AWS SNS services and completed the initial setup as the AWS documentation. I just needed to test it using aws-cli. So I used the following command to publish a test message to SNS topic from my local PC.

aws sns publish --topic-arn "arn:aws:sns:us-east-1:xxxxxxxxxxx:test-notification-service" --message "Hello, from SNS"

However, I got stuck on the following generic error. It just says Invalid Parameter. I have configured the ~/.aws/credentials as needed.

An error occurred (InvalidParameter) when calling the Publish operation: Invalid parameter: TopicArn
like image 862
Chamin Wickramarathna Avatar asked Dec 06 '22 10:12

Chamin Wickramarathna


1 Answers

The issue is due to cross-region. You AWS-CLI default region might be different to the region your SNS service location.

Check your AWS-CLI location and make sure you are in the same region as your SNS.

To check your region in AWS CLI use:

aws configure get region

To configure your AWS region you can use the command:

aws configure set region <region-name>

https://docs.aws.amazon.com/cli/latest/reference/configure/set.html

like image 133
Aatish Sai Avatar answered Dec 09 '22 16:12

Aatish Sai