Bigair
Bigair

Reputation: 1592

How to deploy GOOGLE_APPLICATION_CREDENTIALS and use from Django app deployed using Elasticbeanstalk

I have an Django app deployed to AWS using Elasticbeanstalk.

I implemented FCM(Firebase Cloud Messaging) relation to Django app. To access FCM feature from Django, it required Firebase Admin SDK installed to django. Firebase Admin SDK requires firebase's private key as json file accessed via env var GOOGLE_APPLICATION_CREDENTIALS.

On my local Mac Book env I set local path to private key json file to GOOGLE_APPLICATION_CREDENTIALS in .bash_profile.

How do I deploy the firebase's privatge key json file to somewhere safe on AWS(S3 maybe) and access from Django app deployed to AWS using Elasticbeanstalk.

Upvotes: 1

Views: 1807

Answers (1)

littleforest
littleforest

Reputation: 2255

  1. Store the private key file in S3, then use .ebextensions to securely download it to your application. See this answer and this answer as examples.

  2. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS in the Elastic Beanstalk console: Go to the environment, click on Configuration, go to Modify Software, and then enter the environment variable, with the value being the path to the credentials file.

Upvotes: 2

Related Questions