little-cartoon-10569
06/18/2020, 11:44 PMaws.ec2.getInstances({ filters: filters });
.
The error is
typescript
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '@pulumi/aws/ec2/index.js'\nRequire stack:\n- /var/task/__index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '@pulumi/aws/ec2/index.js'",
"Require stack:",
"- /var/task/__index.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1133:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)",
" at Module.load (internal/modules/cjs/loader.js:977:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:877:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)",
" at internal/main/run_main_module.js:18:47"
]
}
import * as aws from "@pulumi/aws";
. Maybe I need to explicitly import EC2 somehow?import { getInstances } from "@pulumi/aws/ec2";
and changed the code to just be getInstances({ filters: filters });
but that didn't change the result 😞white-balloon-205
When I try to use a little bit of Pulumi code (which I know I should be able to, there's an exampleNote that currently you cannot use the Pulumi SDKs "at runtime" inside a Lambda. The example you linked to uses the standard JavaScript AWS SDK. An instance of that SDK is available from
aws.sdk
for runtime code - so that code like this can work inside the Lambda:
const s3Client = new aws.sdk.S3();
But this is still ultimately using the AWS SDK, not the Pulumi SDK.little-cartoon-10569
06/19/2020, 12:55 AM