当前位置: 首页 > news >正文

山西有哪些做网站的公司班级优化大师下载安装app

山西有哪些做网站的公司,班级优化大师下载安装app,中国菲律宾数据,logo网站有哪些在上一篇文章中#xff0c;我向您展示了如何创建和部署AWS Lambda。 我们将继续这项工作#xff0c;并只考虑更新该lambda的代码。 我们还将使用AWS API Gateway将REST端点添加到AWS Lambda。 因此#xff0c;在继续之前……#xff08;如果尚未使用#xff09;#xff… 在上一篇文章中我向您展示了如何创建和部署AWS Lambda。 我们将继续这项工作并只考虑更新该lambda的代码。 我们还将使用AWS API Gateway将REST端点添加到AWS Lambda。 因此在继续之前……如果尚未使用请按照上一篇文章中的说明进行操作以确保您具有正在运行的AWS Lambda实例。 步骤1更新您的Lambda 将以下内容粘贴到update-lambda.sh #!/bin/bash### Create the lambda package zip -j helloworld.zip *.pyfunction_namehelloworld package_filehelloworld.zip### Update the lambda code aws lambda update-function-code \--function-name $function_name \--zip-file fileb://$package_file 或Java #!/bin/bash### Create the lambda package mvn packagefunction_namehelloworld package_filetarget/lambda-java-example-1.0-SNAPSHOT.jar### Update the lambda code aws lambda update-function-code \--function-name $function_name \--zip-file fileb://$package_file 使脚本可执行文件chmod x update-lambda.sh并更新lambda ./update-lambda.sh 。 第2步传递一些东西给您的lambda 现在我们知道了如何更新云中的lambda让我们进行更改以便我们可以将某些内容作为参数传递。 与其说“你好世界” 我们希望它向任何人问好。 在Python中 def lambda_handler(event, context):return Hello {}!.format(event[to]) 或类似于Java中的以下内容 package example;import com.amazonaws.services.lambda.runtime.Context;public class Hello {public String lambdaHandler(Request request, Context context) {return Hello request.getTo() !;} }class Request {private String to;public void setTo(String to) { this.to to; }public String getTo() { return to; } }步骤3告诉Lambda与任何人打招呼 aws lambda invoke --invocation-type RequestResponse --function-name helloworld --payload {to: whomever} output.txt 你应该看到谁你好 在输出文本中 步骤4让我们添加其余的API 将以下脚本粘贴到诸如create-api.sh的文件中更改该文件的执行权限然后执行该脚本。 深吸一口气…… 注意此脚本期望定义AWS_REGION和AWS_ACCOUNT_ID环境变量 #!/bin/bash set -eregion$AWS_REGION account_id$AWS_ACCOUNT_IDecho Creating a new API and capturing its ID ... api_id$(aws apigateway create-rest-api \--name HelloWorldAPI \--description Hello World API \--output text \--query id) echo API ID is: $api_idecho Storing the API ID on disk - well need it later ... echo $api_id api_id.txtecho Geting the root resource id for the API ... root_id$(aws apigateway get-resources \--rest-api-id ${api_id} \--output text \--query items[?path/].[id]) echo root_id$root_idecho Creating a resource for the /hello path resource_id$(aws apigateway create-resource \--rest-api-id ${api_id} \--parent-id ${root_id} \--path-part hello | jq -r .id) echo Resource id is $resource_idecho Creating the GET method on the /hello resource aws apigateway put-method \--rest-api-id ${api_id} \--resource-id ${resource_id} \--http-method GET \--authorization-type NONE echo Integrating the GET method to lambda. Note that the request tempalate uses API Gateway template language to pull in the query parameters as a JSON event for the lambda. aws apigateway put-integration \--rest-api-id ${api_id} \--resource-id ${resource_id} \--http-method GET \--type AWS \--request-templates { application/json: {\n #foreach($param in $input.params().querystring.keySet())\n \$param\: \$util.escapeJavaScript($input.params().querystring.get($param))\ \n #end\n } } \--integration-http-method POST \--uri arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${region}:${account_id}:function:helloworld/invocationsecho Creating a default response for the GET method aws apigateway put-method-response \--rest-api-id ${api_id} \--resource-id ${resource_id} \--http-method GET \--status-code 200 echo Creating a default response for the integration aws apigateway put-integration-response \--rest-api-id ${api_id} \--resource-id ${resource_id} \--http-method GET \--status-code 200 \--selection-pattern .*echo Adding permission for the API to call the lambda for test so we can use the console to make the api call aws lambda add-permission \--function-name helloworld \--statement-id apigateway-helloworld-get-test \--action lambda:InvokeFunction \--principal apigateway.amazonaws.com \--source-arn arn:aws:execute-api:${region}:${account_id}:${api_id}/*/GET/helloecho Adding permission for the API to call the lambda from any HTTP client aws lambda add-permission \--function-name helloworld \--statement-id apigateway-helloworld-get \--action lambda:InvokeFunction \--principal apigateway.amazonaws.com \--source-arn arn:aws:execute-api:${region}:${account_id}:${api_id}/api/GET/helloecho Creating a deployment aws apigateway create-deployment \--rest-api-id ${api_id} \--stage-name api echo All done! you can invoke the api on https://${api_id}.execute-api.${region}.amazonaws.com/api/hello?towhomever步骤5调用API 脚本的最后输出提供了可以粘贴到浏览器中的URL。 您应该看到“你好你好”的回答。 一旦您点击进入浏览器。 步骤6清理 您可以使用上delete.sh创建的delete.sh脚本删除lambda。 删除api粘贴以下脚本并照常执行。 #!/bin/bash echo Reading API id that I store in my create-api script api_id$(api_id.txt)echo Removing the permissions from the lambda aws lambda remove-permission \--function-name helloworld \--statement-id apigateway-helloworld-get aws lambda remove-permission \--function-name helloworld \--statement-id apigateway-helloworld-get-testecho Deleting the API aws apigateway delete-rest-api \--rest-api-id ${api_id}步骤7放松……结束 … 目前 翻译自: https://www.javacodegeeks.com/2016/05/aws-lambda-api-gateway.html
http://wiki.neutronadmin.com/news/73913/

相关文章:

  • 做软装设计找图有什么好的网站沃尔玛官方网站查余额
  • 建设公司营销网站网站建设合同付款约定
  • 如何让网站关键词搜录网站建设公司软文
  • 娄底网站建设查域名注册人
  • 嘉禾县网站建设推广公司功能型类的网站
  • 江苏网站建设公司哪家好怎么推广游戏叫别人玩
  • 乐山建设企业网站网站建设制作软件
  • 做动态的网站软文是什么样子的
  • 在线网站搭建系统呼市网页设计培训
  • 卫浴毛巾架网站建设福建住房和建设网站密码忘记
  • 国内设计大神网站电商网页图片设计
  • wordpress预约订单插件河南seo推广平台
  • 自己做照片书的网站社交电商
  • 深圳网站建设李天亮网站制作 商务
  • it项目网站开发的需求文档电商第三方平台有哪些
  • wordpress教育网站宣传型电子商务网站
  • 学校网站前置审批专业创业服务平台网站建设需求
  • 网络营销怎么做网站有哪些网站是可以接单做任务的
  • 智能家居网站建设方案有域名了建立免费网站
  • .net 网站开发框架重庆璧山新闻最新消息
  • 免费外贸网站制作家装企业网站系统下载
  • dede 网站内页标题修改石家庄做商城网站的公司
  • 网站建设需要的语言满版型网站有哪些
  • 站长工具域名解析温州英文网站建设
  • 四平网站建设怎么选多层次网络营销合法吗
  • 手机投资理财网站建设怎么在网上找接单做网站的公司
  • 长沙 直播网站建设宝安网站建设公司968
  • 济南 网站开发江苏省电力建设一公司网站
  • 丽水手机网站建设中国建筑集团有限公司官网赵钊
  • 百度搜索网站带图片中关村在线手机对比