如何在AWS CLI SNS消息中提供JSON?

如何在AWS CLI SNS消息中提供JSON?,json,aws-cli,amazon-sns,Json,Aws Cli,Amazon Sns,如何在命令行中通过aws cli发送准确的JSON结构(不是通过文件): 这是直接在命令行中提供的正确JSON结构吗?您提供的JSON结构是在AWS CLI for SNS中传递JSON的正确方法 我在如下所示的测试环境中进行了测试,并确认100%正常工作: 带有--消息结构json参数集: 使用Windows AWS CLI测试: aws sns publish --topic-arn "arn:aws:sns:eu-west-2:123412341234:some-topic&qu

如何在命令行中通过aws cli发送准确的JSON结构(不是通过文件):


这是直接在命令行中提供的正确JSON结构吗?

您提供的JSON结构是在AWS CLI for SNS中传递JSON的正确方法

我在如下所示的测试环境中进行了测试,并确认100%正常工作:

带有
--消息结构json
参数集:

使用Windows AWS CLI测试:

aws sns publish --topic-arn "arn:aws:sns:eu-west-2:123412341234:some-topic" --message-structure json --message '{\"default\":\"This is the default Message\",\"sqs\": \"value\"}'
Json消息格式如下:

{
    "default": "A message.",
    "email": "A message for email.",
    "email-json": "A message for email (JSON).",
    "http": "A message for HTTP.",
    "https": "A message for HTTPS.",
    "sqs": "A message for Amazon SQS."
}

你试过了吗?有用吗?我试过我的SNS主题。消息发送正确。您拥有有效的JSON格式,因此看起来它是直接发送JSON的合适格式。
{
    "default": "A message.",
    "email": "A message for email.",
    "email-json": "A message for email (JSON).",
    "http": "A message for HTTP.",
    "https": "A message for HTTPS.",
    "sqs": "A message for Amazon SQS."
}