AWS SNS CLI Command Publish Message Attributes

If you want to send a message attributes using AWS SNS using CLI you can make use of the aws sns publish command and --message-attributes option.

aws sns publish --topic-arn arn 

--message "Testing AWS SNS with message attributes" 
--message-attributes attribute_name={DataType=String,StringValue=value} 

DataType: The data type of the attribute can be a String, Number, or Binary.


aws sns publish 
--topic-arn arn:aws:sns:us-east-1:13xx6xx9xx:smsTopic 
--message "Important notification" 
  Name={DataType=String,StringValue=Sam} Age={DataType=Number,StringValue=22}
AWS SNS CLI Topic Message Attributes Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap