Step 3. Configure Push notifications in AWS
In this step, you use the service account and key created in the previous steps to set up Amazon Simple Notification Service (SNS) to be able to route push notification messages to Android and iOS devices.
You also create a service account and associated access token to provide access to the service to your server.
Set up AWS for Android push notifications
-
Log in to the AWS console: https://console.aws.amazon.com/console/home
-
In the search bar, enter
SNS
, and then select Simple Notification Service from the list of results.Click the star icon () to pin the service to the toolbar in the AWS console. -
In the left menu, navigate to
. -
In the Platform applications panel, click Create platform application.
-
On the Create platform application page:
-
In Application name, enter a name for the platform application.
For example,
Android_Push_Messaging
. -
In Push notification platform, select Firebase Cloud Messaging (FCM).
The page displays the Firebase Cloud Messaging Credentials section.
-
In Authentication method, select Token.
The page displays additional fields.
-
In Service JSON, click Choose file, and navigate to the JSON file that you downloaded from Firebase when you created a Firebase key previously.
-
-
Click Create platform application.
The page creates the application and displays the details pane:
Figure 1. An Android platform application in AWS, showing the ARN.
-
-
Make a note of the ARN value. You need this value when you Configure a server for push notifications.
Set up AWS for iOS push notifications
-
Log in to the AWS console: https://console.aws.amazon.com/console/home
-
In the search bar, enter
SNS
, and then select Simple Notification Service from the list of results.Click the star icon () to pin the service to the toolbar in the AWS console. -
In the left menu, navigate to
. -
In the Platform applications panel, click Create platform application.
-
On the Create platform application page:
-
In Application name, enter a name for the platform application.
For example,
iOS_Push_Messaging
. -
In Push notification platform, select Apple iOS/VoIP/MacOS.
The page displays the Apple credentials section.
-
In the Apple credentials section:
-
In Push service, select iOS.
-
In Authentication method, select Token.
The page displays additional fields.
-
In Signing key, click Choose file, and navigate to the
.p8
file that you downloaded from Apple when you registered a new key for APNs.After selecting the file, the page populates the Signing key text field with the private key from the
.p8
file. -
In Signing key ID, enter the 10-digit ID of the key you created when you registered a new key for APNs.
For example,
YUGX2BO820
. -
In Team ID, enter the ID of your team in the Apple Developer Program.
You can view your Team ID on the Membership details page in the Apple developer console. -
In Bundle ID, enter the bundle ID of the iOS application you are adding push notifications to.
For example,
com.forgerock.authenticator.sample
.
-
-
Click Create platform application.
The page creates the application and displays the details pane:
Figure 2. An iOS platform application in AWS, showing the ARN.
-
-
Make a note of the ARN value. You need this value when you Configure a server for push notifications.
Create a service account with access to the ARN endpoints
-
Log in to the AWS console: https://console.aws.amazon.com/console/home
-
In the search bar, enter
IAM
, and then select IAM from the list of results.Click the star icon () to pin the service to the toolbar in the AWS console. -
In the left menu, navigate to
. -
Click Create user.
-
In User name, enter a name for the user account that the access key will represent.
For example,
sns_arn_user
. -
Click Next.
-
In Permissions options, select Attach policies directly.
The page displays additional fields.
-
In Permissions policies, in the search bar, enter
SNSFull
, and then select the checkbox next toAmazonSNSFullAccess
.Figure 3. Adding the SNS permission policy to a user in AWS IAM. -
Click Next, review the details of the account, and then click Create user.
Create an access token for the service account
-
Log in to the AWS console: https://console.aws.amazon.com/console/home
-
In the search bar, enter
IAM
, and then select IAM from the list of results.Click the star icon () to pin the service to the toolbar in the AWS console. -
In the left menu, navigate to
, and then click the service account you created previously. -
In the Summary pane, click Create access key.
-
On the Access key best practices & alternatives page:
-
In Use case, select Third-party service
-
Under Confirmation, select the I understand the above recommendation and want to proceed to create an access key checkbox.
-
Click Next.
-
-
In Description tag value, enter the purpose of the access key.
For example,
server access to SNS ARN endpoints
-
Click Create access key.
-
Make a note of the provided values:
-
Access Key ID.
For example,
AKIAXOSPRCH15LEES
-
Secret access key.
For example,
9eF7EcWMZzChI51BBHkLeElXk8R3XHv7/n7QSiwoUFJ
Click Download .csv file to download a file containing the values for safe-keeping. -
-
Click Done.