amazon-web-services - AWS V3 教程 - 创建和使用 Lambda 函数
问题描述
我正在试用适用于 Javascript 的 AWS SDK 的第 3 版教程。以下是网址: https ://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/lambda-create-table-example.html
我曾多次尝试按照上述步骤进行操作,但均未成功。
如果有人在 V3 中成功使用了本教程,或者更有经验的人可以尝试让我知道我做错了什么,那将有很大帮助。
我已按照以下步骤操作:
步骤 1. 使用 AWS CloudFormation 创建 AWS 资源
created describe-stack-resources.js, setup.yaml
in command prompt->aws cloudformation create-stack --stack-name [STACK_NAME] --template-body file://setup.yaml --capabilities CAPABILITY_IAM
in command prompt->node describe-stack-resources.js [STACK_NAME]
noted down IAM_ROLE, IDENTITY_POOL_ID, and BUCKET_NAME
步骤 2. 创建 Html
created LambdaApp/index.html and uploaded to S3 bucket
步骤 3. 准备浏览器脚本
created LambdaApp/dynamoClient.js and LambdaApp/lambdaClient.js
created LamdaApp/index.js with function name = createTable
in command prompt->webpack LambdaApp/index.js --mode development --target web --devtool eval -o LambdaApp/main.js
webpack created main.js
步骤 4. 创建 Lambda 函数
created a file called mylambdafunction.js
webpacked it to create index.js
zipped index.js to my-lambda-function.zip.
Uploaded zip file to S3 bucket
步骤 5. 部署 Lambda 函数
created lambda-function-setup.js
in command prompt-> node lambda-function-setup.js
我可以在 AWS 中看到 createTable 函数但是当我运行 html 的 url 时,我得到一个错误 createTable is not defined
解决方案
推荐阅读
- c++ - 在大型程序中将长变量更改为 int 类型
- javascript - 我的上下文是在构造函数中定义的,而不是在函数中定义的。无法读取 HTMLCanvasElement.draw 处未定义的属性“beginPath”
- javascript - 生成随机对象
- ios - 我可以在 UISwitch 中设置描述值吗?
- c# - C#:如何找到 2 个可为空的日期时间之间的天数差异?
- angular - IIS7 上的 Angular 7 应用程序中的 500(URL 重写模块错误。)
- regex - XML 正则表达式,用于在输入字符串中排除名为“County”的单词,并且可以接受任何单词/数字/空格
- python - 如何使用 Sympy 自动简化二值有限域上的表达式?
- jquery - 如何通过类名查找元素的父级并添加 CSS?
- swift - 如何隐藏像example.app这样的包文件?