When creating a new platform application, what would be the recommended way to supply the credentials from files?
Like if I have a certificate and private key in .pem files
app.crt.pem
app.key.pm
So var I've tried:
aws sns create-platform-application --name app-development --platform APNS --attributes PlatformPrincipal=app.crt.pem,PlatformCredential=app.key.pem
aws sns create-platform-application --name app-development --platform APNS --attributes PlatformPrincipal=file://app.crt.pem,PlatformCredential=file://app.key.pem
aws sns create-platform-application --name app-development --platform APNS --attributes PlatformPrincipal=$(cat app.crt.pem),PlatformCredential=$(cat app.key.pem)
The last one doesn't work probaby because bash replaces newlines with spaces
All I'm getting is:
ClientError: A client error (InvalidParameter) occurred when calling the CreatePlatformApplication operation: Invalid parameter: PlatformPrincipal not valid.
Could you look at your --debug
logs? It should show you what is being sent over the wire. If you wish to post them here, please use dummy files.
Thanks, I've figured it out, the way I'm doing it is creating a shell script, which assigns file contents to variables, and then putting the variables in parameters
@zen4ever Can you share your script for how you solved it in the end?
If anyone runs into this issue from google (like I did), my solution :
Example: ./snsPlatformAppCreate.sh my-app APNS ./private.pkey ./cert.pem
snsPlatformAppCreate.sh
sns_name="$1"
platform="$2"
credential=`cat "$3"`
principal=`cat "$4"`
aws sns create-platform-application --platform "$platform" --name "$sns_name" --attributes PlatformCredential="$credential",PlatformPrincipal="$principal"
Most helpful comment
If anyone runs into this issue from google (like I did), my solution :
Example: ./snsPlatformAppCreate.sh my-app APNS ./private.pkey ./cert.pem
snsPlatformAppCreate.sh