How do I upload APNs certificates for my Amazon Pinpoint application using the AWS CLI?

Last updated: 2021-01-12

I want to upload Apple Push Notification service (APNs) certificates to my Amazon Pinpoint application. How can I do that using the AWS Command Line Interface (AWS CLI)?

Resolution

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.    If you haven’t already, install and configure the AWS CLI.

2.    Log in to your Apple developer account and obtain a provider certificate.

Important: Make sure that you export the provider certificate as a .p12 file. Rename the file APNSCertificates.p12.

3.    If you haven't already, install openssl.

4.    Using the AWS CLI, run one or both of the following commands to enable and upload the APNS certificate from your Mac Terminal:

Note: The type of environment and certificate you create will determine which of the following commands you use.

To enable the APNs sandbox channel for an Amazon Pinpoint application

aws pinpoint update-apns-sandbox-channel --application-id f7eae591bbdc4a6bb3a0fff423f1e3eb --apns-sandbox-channel-request "Certificate=$(openssl pkcs12 -in APNSCertificates.p12 -nodes -nokeys), Enabled=true,PrivateKey=$(openssl pkcs12 -in APNSCertificates.p12 -nodes -nocerts)" --region us-west-2

To enable the APNs channel for an Amazon Pinpoint application

aws pinpoint update-apns-channel --application-id f7eae591bbdc4a6bb3a0fff423f1e3eb --apns-channel-request "Certificate=$(openssl pkcs12 -in APNSCertificates.p12 -nodes -nokeys), Enabled=true,PrivateKey=$(openssl pkcs12 -in APNSCertificates.p12 -nodes -nocerts)" --region us-west-2

Important: Make sure that you replace --application-id and --region with the project ID of your Amazon Pinpoint application and Region. Also, make sure that you enter the APNs certificate passwords for each command, if required.

After the AWS CLI command runs, your APNs channel will be enabled and your APNs certificate will be uploaded to your Amazon Pinpoint application.


Did this article help?


Do you need billing or technical support?