I want to create a platform application in Amazon Simple Notification Service (Amazon SNS) to send push notifications to Android devices.
To create a platform application in Amazon SNS to send push notifications to Android devices, do one of the following:
Note: Amazon SNS push notifications aren't available in all AWS Regions. For more information, see Supported Regions for mobile applications.
You must have a Firebase project and a valid Android app registered with Firebase. For instructions, see Step 1: Create a Firebase project and register your app in the Firebase documentation.
You must also have valid credentials from Firebase Cloud Messaging (FCM), including a valid FCM project API key (Server key). For more information, see Firebase Cloud Messaging in the Firebase documentation.
Note: Amazon SNS currently doesn't support FCM API (v1). To access the Server key, use FCM API (legacy).
To retrieve your FCM project's API key (Server key)
1. In the Firebase console, choose your project.
2. In the left navigation pane, choose the gear icon. Then, choose Project settings.
3. Choose the Cloud Messaging tab.
4. Under Project credentials, find the Server key. This token is your FCM project's API key. Copy it to your clipboard.
Use the Amazon SNS console to create an Android platform application
1. Open the Amazon SNS console.
2. In the left navigation pane, choose Mobile. Then, choose Push notifications.
3. On the Mobile push notifications page, next to Platform applications, choose Create platform application.
4. On the Create platform application page, under Details, do the following:
For Application name, enter the name of your application.
For Push notification platform, choose Firebase Cloud Messaging (FCM).
Under Firebase Cloud Messaging Credentials, for API key, enter your FCM project's API key (Server key).
5. (Best practice) Set up event notifications and delivery status logging.
6. Choose Create platform application.
Run the create-platform-application AWS CLI command to create an Android platform application
Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent version of the AWS CLI.
1. Copy and paste the following into a text editor. Then, save it as a JSON file named FCMAPIKey.json:
Important: Replace Your_FCM_API_Key with your FCM API key (server key).
2. Run the following create-platform-application AWS CLI command:
Important: Replace Your_Application_Name with your application's name. Make sure that you run the command in the same directory where your FCMAPIKey.json file is located.
aws sns create-platform-application --name Your_Application_Name --platform GCM --attributes file://FCMAPIKey.json
Your platform application's Amazon Resource Name (ARN) appears in the command output.
Example create-platform-application command output
3. (Best practice) Set up event notifications and delivery status logging.
Note: To send push notifications using the Android platform application, follow the instructions in Mobile push notifications.
For more information, see CreatePlatformApplication in the Amazon SNS API Reference.
How do I create an APNs platform application for sending push notifications in Amazon SNS using the AWS CLI?
Adding device tokens or registration IDs
Publishing to a mobile device
Publishing to a topic
Platform response codes