- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- Sam Williams
- 210字
- 2021-07-16 17:45:13
Creating a Lambda using AWS CLI
Now that we’ve got the CLI set up, we can use it to make our lives much easier. To create a new function, you need to have a folder containing an index.js file with a basic Lambda code in. Navigate into that folder in your terminal and now you can run these commands:
zip ./index.zip *
aws lambda create-function \
--function-name your-function-name \
--runtime nodejs8.10 \
--role your-lambda-role \
--handler index.handler \
--zip-file fileb://index.zip
Switch out the your-lambda-role for the arn of the role that you created earlier. You can find this by going back to the IAM service in AWS and selecting Roles and clicking on your Lambda role:

When you run this it will return a JSON blob with some information about your newly created Lambda.
If you edit your index.js code and want to update the Lambda, then there are three commands you need to run:
rm index.zip
zip ./index.zip *
aws lambda update-function-code \
--function-name your-function-name \
--zip-file fileb://index.zip
Using these scripts, you can now write your code locally and deploy it to AWS. This is good but it can be improved, which is what we're going to do next.
- 電子政務效益的經濟分析與評價
- Hands-On Chatbots and Conversational UI Development
- Django 2 by Example
- HCNA網絡技術
- 新一代物聯網架構技術:分層算力網絡
- 數字通信同步技術的MATLAB與FPGA實現:Altera/Verilog版(第2版)
- Learning Swift(Second Edition)
- 通信原理及MATLAB/Simulink仿真
- 基于性能的保障理論與方法
- jQuery Mobile Web Development Essentials
- 5G技術與標準
- 計算機網絡技術及應用
- 端到端QoS網絡設計
- Learning Storm
- 物聯網工程導論(第3版)