Setting up AWS SNS for iOS

Russell Stephens
Compass True North
Published in
4 min readApr 12, 2017

Push notifications are a useful feature for engaging your users. They function like a text message that, when clicked, can open the engaging app within a certain context. Urban Airship provides a more in depth look here.

When it comes to setting up the infrastructure for Push Notifications there are a couple of different vendors to use, as well as the option to roll-your-own.

Here at Compass, our backend utilizes AWS in a variety of ways. Given that our backend notification service is built upon SQS it made sense to utilize SNS as our APNS server.

Part 1 : Research and Documentation

The UI of both the iOS Provisioning Portal, and AWS has changed significantly since the the original documentation was published. This can lead to both confusion and dead ends:

Thankfully, there are some organizations which still use SNS. This post from Ankush Aggarwal, a Software Engineer at Paypal, walks through the process of adding Push Notifications to a new app quite elegantly.

Part 2 : Organizing Chaos

Throughout the course of our careers, we may not always be so fortunate as to start with a clean slate. That said, when adding Push Notifications to a system which may or may not already have existing SNS Apps, we believe it is better to leave the code a little better than you found it, than to leave no trace of your changes.

Since the original implementors moved on well before our current team joined Compass, we started documenting our Push Notification setups by trying to organize our existing infrastructure into a simple table.

Taming the System by documenting whats there

Next, we wanted to come up with a basic naming scheme that could be used to describe what each SNS application was for in order to leave the newer implementations just a little better than the state they were found in.

An attempt of structure amid chaos

Part 3 : Building for the future

We were now at a point where the new APNS certificates were ready to be added into our system.

  • Select the App for the list, and select Edit
The Push Notification Feature might not say “Configurable” until you check the option (see below)
  • Navigate to the Push Notification Section
  • Open Keychain Access and create a certificate request, and save to disk
  • Use the request to generate, download, and open the certificate in your keychain

To upload the certification and create an SNS application we will need to create a .p12 file. It is important to note that you do not want to export the cert with the private key, this will cause issues on SNS.

  • Right click on the cert in Keychain Access and select Export
  • Save using the same naming scheme from the table above, and an easily remembered password which is needed for SNS
  • Navigate to your SNS console in AWS, and select Create Application
  • Create the new application with the same name as the certificate we exported
  • Click Create platform, and your app is now configured for SNS

On Reflection

Having never integrated with SNS before, we found this entire process to be confusing and needlessly difficult. The outdated documentation provided by AWS led us to question how heavily the tool is used. Unfortunately, SNS integrated best with our backend, and the legacy apps of Compass Mobile past had proven that it is possible. However, for such a highly utilized feature the tooling and support leaves much to be desired.

Take this guide with a grain of salt — as the UI for both Apple and Amazon’s tools change, surely, this article will become just another deprecated user guide for SNS.

--

--