AWS SNS - How to get SNS topic by name?

0 votes

I am working with AWS SNS to send push notifications to my app. To get a topic that I want, to send push notifications to, I need to load all topics – using SNS client function listTopics() - and check each topic to see if the ARN has the name of the topic that I'm looking for.

I think that it's a very inefficient way to get a topic ARN.  Is there a most efficient way to get this information, like a function getTopicByName?

If not, I'd like to know if ARN is immutable, and if can I store the topic ARN on my database?

Thanks.

Sep 4, 2018 in AWS by datageek
• 2,430 points
89 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

If you know the topic already exists or you don't care if it gets created, then a much more direct approach, it is simply to call CreateTopic. Given a name, CreateTopic will return the existing topic, including the ARN.

answered Sep 4, 2018 by Archana
• 4,090 points

Related Questions In AWS

+1 vote
3 answers

How to get ARN for s3 Bucket using aws cli .

An ARN is a non-opaque, constructible identifier, ...READ MORE

answered Aug 16, 2018 in AWS by Priyaj
• 56,140 points
801 views
0 votes
1 answer

How to get AWS account/service cost using CloudWatch API?

You can check this link for a ...READ MORE

answered Jul 13, 2018 in AWS by Priyaj
• 56,140 points
135 views
+1 vote
2 answers

How to use jenkinsfile to get content from AWS SQS?

You can import standard AWS SDK to ...READ MORE

answered Jul 20, 2018 in AWS by Flying geek
• 3,130 points
114 views
+3 votes
1 answer

How to get a Job for AWS cloud architect

A Cloud Architect is an IT specialist who is ...READ MORE

answered Sep 25, 2018 in AWS by Priyaj
• 56,140 points
57 views
0 votes
1 answer

How to get aws lambda response as an HTML page

Store the HTML markup in a variable and return ...READ MORE

answered Dec 4, 2018 in AWS by Archana
• 5,360 points
83 views
0 votes
1 answer

How to get AWS Bandwidth fora year?

It's very easy. Just click on your account ...READ MORE

answered Feb 12 in AWS by Archana
• 5,360 points
11 views
0 votes
2 answers

How to display just the name of files using aws s3 ls command?

aws s3 ls s3://<your_bucket_name>/ | awk '{print ...READ MORE

answered Mar 17 in AWS by anonymous
1,710 views
0 votes
1 answer

How to Restrict AWS Resource Access to a Specific IAM Role

You can use iam get-role to find the Role-Id and add ...READ MORE

answered Aug 13, 2018 in AWS by Archana
• 4,090 points
49 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.