AWS Lambda visit the Amazon CloudWatch log

AWS Lambda Lambda automatically for you to monitor functions, and the indicators by Amazon CloudWatch report. To help you diagnose the problem in the function, Lambda will record all your function requests processed and produced by Amazon CloudWatch Logs log automatically stores your code.

You can insert logging statements in your code to help verify that the code is running as expected. Lambda automatically integrated with CloudWatch Logs, all logs and push your code associated with a function of Lambda CloudWatch Logs group (i.e., the name / aws / lambda / <函数名> group). For more information about log groups, and access them via the CloudWatch console, see  Amazon CloudWatch user guide  in monitoring systems, applications, and custom log file .

You can use Lambda console, CloudWatch console, AWS CLI or CloudWatch API log view Lambda. The following procedure describes how to use Lambda console to view logs.

note

Lambda log using no extra cost; however, CloudWatch Logs will be charged the standard fee. For more information, see  CloudWatch pricing .

Use Lambda console to view logs

  1. Open  Lambda console .

  2. Open Lambda console  function page .

  3. Select  Monitoring .

    
          event

    Lambda is expressed as shown in the graphical indicator function.

  4. Select View CloudWatch the logs .

Lambda permission to use your function to upload the log CloudWatch Logs. If you do not see the log in the console, please check your perform the role permissions .

AWS Lambda perform the role

AWS Lambda functions perform the role of the function of granting access to AWS services and resources. You provide this role when you create a function, when your function is called, Lambda substituted into the role. You can create a right to send logs to the Amazon CloudWatch and upload the data to track the development of performing the role of AWS X-Ray.

Creating perform the role

  1. Open the IAM console "role" page .

  2. Select  Create role (create roles) .

  3. Create a role with the following properties:

    • Trusted entity  -  AWS the Lambda .

    • Permissions  -  AWSLambdaBasicExecutionRole , AWSXrayWriteOnlyAccess

    • Role name  - lambda-role

You can always add a role in the execution of the function or remove permissions, or configure your function to use the different roles. Any use of AWS services development tool package for your function calls and add permissions for the Lambda used to enable optional features of the service.

The following policy provides hosting the permission required to Lambda functions:

  • AWSLambdaBasicExecutionRole  - logs uploaded to the rights of CloudWatch.

  • AWSLambdaKinesisExecutionRole  - Read permission event from Amazon Kinesis data stream or the user.

  • AWSLambdaDynamoDBExecutionRole  - read Amazon DynamoDB flow records authority.

  • AWSLambdaSQSQueueExecutionRole  - read queue messages Amazon Simple Queue Service (Amazon SQS) permissions.

  • AWSLambdaVPCAccessExecutionRole  - resilient network management interfaces to connect your VPC permission to function.

  • AWSXrayWriteOnlyAccess  - permission to upload data to track the X-Ray.

When you use the event source mapping when you call your function, Lambda will be used to perform the role of read event data. For example, Amazon Kinesis to your event source mapping function from the data stream read into the events and wholesale. Event maps the source for the following services:

In addition to hosting strategy, Lambda console also includes providing a template for creating custom policies and additional permissions related cases used. When you create a function, you can choose to create a new executive role use authority from one or more templates. When you create a function from a blueprint, or configuration options need to access other services, will automatically apply the template. Examples of this guide template from  GitHub repository found in.

Guess you like

Origin www.cnblogs.com/cloudrivers/p/11619265.html