Configure SNS for push notifications
✓Works with OpenClaudeYou are an AWS cloud architect. The user wants to configure Amazon SNS (Simple Notification Service) to send push notifications to mobile devices and applications.
What to check first
- Run
aws sts get-caller-identityto verify AWS CLI is configured with correct credentials - Check
aws sns list-topicsto see existing SNS topics in your region - Verify your AWS account has SNS service limits not exceeded via AWS Console → Service Quotas
Steps
- Create an SNS topic using
aws sns create-topic --name MyPushTopicand save the TopicArn from the response - Create a platform application with
aws sns create-platform-application --name MyMobileApp --platform GCM --attributes PlatformCredential=<server_api_key>(use APNS for iOS, GCM/FCM for Android) - Register device endpoints using
aws sns create-platform-endpoint --platform-application-arn <arn> --token <device_token>for each device - Subscribe the platform endpoint to your SNS topic with
aws sns subscribe --topic-arn <topic-arn> --protocol application --notification-endpoint <endpoint-arn> - Test notification delivery with
aws sns publish --topic-arn <topic-arn> --message "Test notification" --message-structure json - Set up SNS delivery status logging by enabling CloudWatch logs on the platform application
- Configure message attributes and filtering policies in your subscription for selective message routing
- Implement error handling and retry logic in your application to manage failed deliveries
Code
import boto3
import json
from datetime import datetime
class SNSPushNotificationManager:
def __init__(self, region_name='us-east-1'):
self.sns_client = boto3.client('sns', region_name=region_name)
def create_topic(self, topic_name):
"""Create SNS topic for notifications"""
response = self.sns_client.create_topic(Name=topic_name)
return response['TopicArn']
def create_platform_app(self, app_name, platform, credentials):
"""Create platform application (iOS/Android)"""
# platform: 'APNS' (iOS), 'GCM' (Android), 'APNS_SANDBOX'
response = self.sns_client.create_platform_application(
Name=app_name,
Platform=platform,
Attributes={
'PlatformCredential': credentials['api_key'],
'EventEndpointCreated': 'arn:aws:sns:region:account:topic',
'EventEndpointDeleted': 'arn:aws:sns:region:account:topic',
'EventEndpointUpdated': 'arn:aws:sns:region:account:topic',
'EventDeliveryFailure': 'arn:aws:sns:region:account:topic'
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Cloud (AWS/GCP/Azure) Skills
Other Claude Code skills in the same category — free to download.
Lambda Function
Create AWS Lambda function with handler
S3 Operations
Set up S3 bucket operations (upload, download, presigned URLs)
DynamoDB CRUD
Create DynamoDB CRUD operations
SQS Setup
Set up SQS queue producer and consumer
CloudFront Setup
Set up CloudFront CDN distribution
Cognito Auth
Implement AWS Cognito authentication
RDS Setup
Configure RDS database connection
ECS Task Definition
Create ECS task definitions
Want a Cloud (AWS/GCP/Azure) skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.