0

I need to access to GCP's Compute Engine API in AWS Lambda using Python. API: https://cloud.google.com/compute/docs/reference/rest/v1

I need https://cloud.google.com/compute/docs/reference/rest/v1/disks/list and store the response in JSON format to my s3.

I had a few other queries with just API Key authentication, but this one seems to have OAuth2.0 authentication. So I'll need a bearer token for my API request.

I am relatively new to cloud computing and Python overall. I have already tried following https://stackoverflow.com/a/53472880/13676851 , but couldn't get my hand around it.

Can someone please help me to direct towards right resources to get OAuth2 Access Token / Bearer Token in the AWS Lambda using Python.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
NoobxNoob
  • 23
  • 1
  • 3
  • 2
    I wrote the answer you reference. For your use case, you should use a Google Cloud Service Account. Usually you download the Service Account Key as a JSON file. https://cloud.google.com/iam/docs/service-accounts Most developers use the Google Cloud Python Client libraries to make API calls. I wrote an article that shows how to do REST API calls without Google libraries. This example shows how to create the Access Token for HTTP Bearer Authorization and list Compute Engine instances: https://www.jhanley.com/google-cloud-creating-oauth-access-tokens-for-rest-api-calls/ – John Hanley Sep 16 '20 at 04:09
  • 1
    Google Cloud Client Libraries for Python: https://cloud.google.com/compute/docs/tutorials/python-guide – John Hanley Sep 16 '20 at 04:14

0 Answers0