# Ensure Lambda Logging Allowed by IAM Role

- Source: https://support.icompaas.com/support/solutions/articles/62000218465-ensure-lambda-logging-allowed-by-iam-role
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Security Controls](https://support.icompaas.com/support/solutions/62000065178) › [Automation Policies](https://support.icompaas.com/support/solutions/folders/62000167189)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Description**: 

A Lambda function's execution role is an AWS Identity and Access Management (IAM) role that grants the function permission to access AWS services and resources. You provide this role when you create a function, and Lambda assumes the role when your function is invoked. You can create an execution role for development that has permission to send logs to Amazon Cloud Watch and to upload trace data to AWS X-Ray.  
  

**Rationale:**

AWS Lambda integrates with other AWS services to invoke functions. You can configure triggers to invoke a function in response to resource lifecycle events, respond to incoming HTTP requests, consume events from a queue, or  [](https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents.html "https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents.html")run a schedule  
  

**Default Value:**

The default value of the lambda function is disabled.  
  

### **Pre-Requisite:**

 1. Lambda creates an execution role with minimal permissions

 2. Create an IAM role for your Lambda function

3. Create a policy that has lambda full access. 

### **Remediation:**

**Test Plan:**

**Step 01:** Open the Function Page on the Lambda console.

**Step 02**: Choose a function.![](https://support.icompaas.com/assets/kb/f44c6e517c3434e6.png)

**Step 03**: Then choose configuration.![](https://support.icompaas.com/assets/kb/3b2e3ea835d8a472.png)

**Step 04:** Click on permisions.

![](https://support.icompaas.com/assets/kb/01b5b21429dac456.png)

**Step 05:** Under **Resource summary**, view the services and resources that the function can access. The following example shows the Cloud Watch Logs permissions that Lambda adds to an execution role when you create it in the Lambda console. ![](https://support.icompaas.com/assets/kb/0b16c0374b44f238.png)

**Step 6 :**Choose a service from the dropdown list to see permissions related to that service.  
  

**Using AWS CLI:**

**To know which role is attached to it** 

aws lambda get-function \\
    --function-name  my-function

**Implementation Steps:**  

**Step 01:** Open the Roles Page in the IAM console.  
![](https://support.icompaas.com/assets/kb/ca2230673f69bcc7.png)

**Step 02:** Choose to Create the role.  
![](https://support.icompaas.com/assets/kb/659b6c62c791f6d6.png)

**Step 03:** Under Common use cases, choose Lambda and Choose Next: Permissions.  
![](https://support.icompaas.com/assets/kb/957e299c69c359e1.png)

**Step 4:**Under Attach permissions policies, choose the AWS managed policies AWS Lambda Basic Execution Role   
![](https://support.icompaas.com/assets/kb/7a0a9cc0d886262e.png) 

**Step 05**: Choose Next, and Review.  
![](https://support.icompaas.com/assets/kb/080b6d98620f35eb.png)

**Step 06:** For Role name, enter lambda-role, choose a created role.  

**Step 07:**  Log in to the lambda [https://us-east-1.console.aws.amazon.com/lambda](https://us-east-1.console.aws.amazon.com/lambda "https://us-east-1.console.aws.amazon.com/lambda") 

**Step 08:** Click on the functions ![](https://support.icompaas.com/assets/kb/d74f3fb3d32c6c42.png) 

**Step 09:** Click on the lambda function you want to make changes ![](https://support.icompaas.com/assets/kb/a785f7fe51f7f389.png) 

**Step 10:** Click on the configuration tab ![](https://support.icompaas.com/assets/kb/a18828a1b8934bec.png) 

**Step 11:** Click on the Permission ![](https://support.icompaas.com/assets/kb/9b65ec63ac061370.png) 

**Step 12:** Click on the Edit ![](https://support.icompaas.com/assets/kb/d7508916a7dad3f8.png) 

**Step 13:** In the Existing Role add the role that you created ![](https://support.icompaas.com/assets/kb/14569ab39e385aef.png) 

**Step 14:** Click on Save ![](https://support.icompaas.com/assets/kb/fc12559130fa1eab.png) 

**Using AWS CLI:** 

{ "Version": "2012-10-17", 

"Statement": \[ { "Effect": "Allow", 

"Principal": { "Service": "lambda.amazonaws.com" },

 "Action": "sts:AssumeRole" } \] }

To create role 

aws iam create-role
\[--path <value>\]
--role-name <value>
--assume-role-policy-document <value>

**Backout Plan:**

**Step 1:** Log in to the lambda [https://us-east-1.console.aws.amazon.com/lambda](https://us-east-1.console.aws.amazon.com/lambda "https://us-east-1.console.aws.amazon.com/lambda")

**Step 2:** Click on the functions

**Step 3:** Click on the lambda function you want to make changes

**Step 4:** Click on the configuration tab

**Step 5:** Click on the Permission

**Step 6:** Click on the Edit

**Step 7:** In the Existing Role add the role that you created

**Step 8:** Click on Save

### **Reference**:

[![](https://support.icompaas.com/assets/kb/3c22486f79da1209.png)](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html)[AWS Lambda execution role - AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html) 

[https://docs.aws.amazon.com/IAM/latest/UserGuide/access\_policies\_generate-policy.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_generate-policy.html)

[https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html#permissions-executionrole-features](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html#permissions-executionrole-features)

[https://docs.aws.amazon.com/IAM/latest/UserGuide/id\_roles\_create\_for-service.html#roles-creatingrole-service-console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html#roles-creatingrole-service-console)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
