Search code examples
jsonaws-cliamazon-sns

How to provide JSON inside AWS CLI SNS message?


How to send via aws cli exact JSON structure in command line (NOT via file):

aws sns publish --topic-arn "arn:aws:sns:us-east-1:12345:myproject_serverlessscheduler_sns" --message '{"key1":"value1", "key2":"value2"}' --profile myprofile

Is this above a correct structure of JSON provided directly inside command line?


Solution

  • The JSON structure you provided is the correct way of passing JSON inside AWS CLI for SNS.

    I tested on my test environment as shown below and confirmed to be working 100% :

    enter image description here