# Deploy serverless with Google Cloud Build

**URL:** <https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574>\
**Category:** Serverless Framework\
**Created:** [June 18, 2019, 3:13pm UTC](https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574 "2019-06-18T15:13:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidjb99](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@davidjb99](https://forum.serverless.com/u/davidjb99)\
**Post date:** [June 18, 2019, 3:13pm UTC](https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574/1 "2019-06-18T15:13:52Z")

</div>

I’m trying to deploy the serverless framework using Google Cloud Build (and Python Cloud Functions).

The serverless.yml file requires an absolute path a credentials file. This works fine for local development and deployment.

However, for Cloud Build deployment I believe the preferred method of authentication is to use a service account which is automatically authenticated without the use of a PK. The only way around this, assuming you don’t want to store your PK within source code, appears to be to download a PK within Cloud Build and place it in the desired directory.

Could anyone confirm if they have found another way around this or if they know if it possible to authenticate using services accounts and serverless?

Thanks

---

<div class="post-metadata">

**Author:** ![shietpas](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shietpas](https://forum.serverless.com/u/shietpas)\
**Post date:** [July 16, 2019, 4:51pm UTC](https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574/2 "2019-07-16T16:51:11Z")

</div>

@davidjb99 Did you implement a Cloud Build solution for serverless that addresses the credentials issue? I am looking to do the same thing and I am curious if you were able to work around the issue.

---

<div class="post-metadata">

**Author:** ![shietpas](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shietpas](https://forum.serverless.com/u/shietpas)\
**Post date:** [July 18, 2019, 12:37pm UTC](https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574/3 "2019-07-18T12:37:54Z")

</div>

@davidjb99 My solution for this was to use GCP’s Key Management Service to encrypt the keyfile. I include the encrypted key in my source code. The Cloud Build process can the use the gcloud kms decrypt command to provide the decrypted keyfile for the serverless process. I’ll work on contributing this to the documentation.

---

<div class="post-metadata">

**Author:** ![captainbeardo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/captainbeardo/32/3569_2.png) [@captainbeardo](https://forum.serverless.com/u/captainbeardo)\
**Post date:** [August 29, 2019, 4:20pm UTC](https://forum.serverless.com/t/deploy-serverless-with-google-cloud-build/8574/4 "2019-08-29T16:20:58Z")

</div>

I made a PR to change the authentication used with uses the correct credentials on cloudbuild. [See here](https://github.com/serverless/serverless-google-cloudfunctions/pull/183).
