I'd like to send logs to google cloud logging from my AWS lambda functions.
I want to use @Google-cloud/logging-winston, but I don't know how I can provide the credentials.
Is it possible?
Hello @rayw,
Welcome to Google Cloud Community!
You may follow these steps to collect logs from Amazaon EC2 instances.
Connect your Amazon account to Google Cloud. If you haven't performed this configuration, then follow the instructions for how to add a monitored project.
Create a service account for the AWS connector project, create a private key for it, and then transfer the private key to your Amazon EC2 instances whose logs you want to exported to Google Cloud. The private key is used to authenticate the Cloud Logging agent.
To create a service account and private key, do the following:
In the Google Cloud console, go to the Service Accounts page of IAM & Admin:
Click Select project and then select your AWS connector project. If you don't know the name of your AWS connector project, the first step in the View logs section of this document describes how to identify that project.
Click Create service account and complete the dialog. Grant the following roles:
- Logs writer
- Monitoring Metric Writer
After you create the service account, edit the service account and then create a private key. Select JSON as the KeyType. When you create a private key, it's downloaded to your workstation. Save a copy of that key to reuse across your Amazon EC2 instances—this is your only chance to save this particular key.
For information about these steps, see Authorize the Logging agent.
Install the Cloud Logging agent on those Amazon EC2 instances whose logs you want exported to Google Cloud. For information about installing the agent, see Installing the Cloud Logging agent on individual VMs.
(Optional) If you also want to export metric data from your Amazon EC2 instances, then install the Cloud Monitoring agent on those instances. For information about installing the agent, see Installing the Cloud Monitoring agent on individual VMs.