我想將 Apple 推送通知服務 (APN) 憑證上傳到 Amazon Pinpoint 應用程式。如何使用 AWS Command Line Interface (AWS CLI) 做到這一點?
解決方法
**注意:**如果您在執行 AWS CLI 命令時收到錯誤訊息,請確保您使用的是最新版本的 AWS CLI。
1. 如果尚未安裝,請安裝和設定 AWS CLI。
2. 登入 Apple 開發人員帳戶並取得供應商憑證。
**重要事項:**確保將供應商憑證匯出為 .p12 檔案。將檔案重新命名為 APNSCertificates.p12。
3. 如果尚未安裝,請安裝 openssl。
4. 使用 AWS CLI 執行下列一個或兩個命令,以從 Mac 終端啟用和上傳 APN 憑證:
**注意:**您建立的環境和憑證類型將決定您使用的命令。
為 Amazon Pinpoint 應用程式啟用 APN 沙盒通路
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
為 Amazon Pinpoint 應用程式啟用 APN 通路
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
**重要事項:**確保使用 Amazon Pinpoint 應用程式和區域的專案 ID 取代 --application-id 和 --region。此外,如有必要,請務必為每個命令輸入 APN 憑證密碼。
執行 AWS CLI 命令之後,APN 通路將啟用,APN 憑證將上傳到 Amazon Pinpoint 應用程式。
相關資訊
使用 AWS CLI
Amazon Pinpoint APN 沙盒 CLI
Amazon Pinpoint APN CLI