Lambda created *-*-custom-resource-apigw-cw-role, what is it?

I just upgraded to Serverless 1.53.0 and deployed a very simple project (1 Lambda and API Gateway). I noticed a new Lambda was created [service]-[stage]-custom-resource-apigw-cw-role. What is this Lambda and what does it do? How often is it executed, memory usage etc…

3 Likes

From what I gather it’s a lambda function used to dynamically define the “CloudWatch log role ARN” property (as part of CloudFormation custom resources feature). This property seems to be an account property (can be controlled in the web console under API Gateway > Settings.
I didn’t find yet how to disable its creation or control it. This is left as a question to the audience.
I’d personally rather not have it run nor created, and in the process avoid giving the serverless user/role too many permissions.

You have provided information to connect to serverless dashboard at serverless.yml file. Probably the auto crated lambda function sends some information from AWS to serverless dashboard. To turn off this auto creation simply remove “app” and “org” from serverless.yml.
app: hello
org: DemoOrg

I have my serverless definition without app and org and still create this function… any know how to avoid it?

I tested using a shared api gateway and using a shared role for the lambda invocations and nothing…

Hi,
If you have below in your serverless.yml:

provider:
    logs:
        restApi: true

Then change from true to false works for me, if you can see the folder where you actually package all your code, the zip file “custom-resource.zip” is gone.
Hope this helps.

Version info:

Serverless: Running "serverless" installed locally (in service node_modules)
Framework Core: 2.64.1 (local)
Plugin: 5.5.0
SDK: 4.3.0
Components: 3.17.1

Cheers