Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][OTHER] Cannot find module 'aws-sdk' on custom config rule lambdas #1206

Open
SEAFork1 opened this issue Jan 16, 2024 · 2 comments
Open
Assignees

Comments

@SEAFork1
Copy link

Bug reports which fail to provide the required information will be closed without action.

Required Basic Info

  • Accelerator Version: 1.5.8-d
  • Install Type: Upgrade
  • Upgrade from version: 1.5.7-b
  • Which State did the Main State Machine Fail in: N/A

Describe the bug
The Instance Profile custom config rule bundled with ASEA fails to evaluate, on closer inspection the backend Lambda function has the following error:

{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/index.mjs",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 'aws-sdk'",
"Require stack:",
"- /var/task/index.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
" at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
" at async start (file:///var/runtime/index.mjs:1282:23)",
" at async file:///var/runtime/index.mjs:1288:1"
]
}

The result of this is the instance profile config rule fails to evaluate and does not attach an instance profile to an EC2 instance.

Steps To Reproduce

  1. Create an EC2 instance without an instance profile attached

Expected behavior
The config rule should evaluate the EC2 instance as non-compliant and then kick off auto-remediation,

@Ray-PHSA
Copy link

Ray-PHSA commented Jan 24, 2024

Hi, any temporary fix or workaround for this? We are also seeing the same issue.
For now, we're having to manually add the IAM role 'EC2-Default-SSM-AD-Role' to the VMs after creation.
Thanks!

@vic614
Copy link
Contributor

vic614 commented Jan 31, 2024

Hi, any temporary fix or workaround for this? We are also seeing the same issue. For now, we're having to manually add the IAM role 'EC2-Default-SSM-AD-Role' to the VMs after creation. Thanks!

You can copy the zip files from this PR to the proper folder in ASEA config bucket. #1207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants