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: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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