zoukankan      html  css  js  c++  java
  • [AWS DA] API Gateway and Lambda Stage variable

    1. First, create a Lambda function call `lambdav1`

    2. Create three alias PROD, TEST, DEV

    For each alias, you can modify the response body code, so that you are able to tell which alias currently working on.

    3. Create API Gateway resouce `/`, method: GET; 

    4. Enable "Use Lambda Proxy integration"

    5. Lambda Function: ``lambdav1${stageVariables.lambdaAlias}

    6. Alert you to add Permission for API Gateway to invoke alias:

    7. Run the commands for `DEV`, `TEST`, `PROD`:

    aws lambda add-permission   
    --function-name "arn:aws:lambda:us-east-1:860348619467:function:lambdav1:PROD"
    --source-arn "arn:aws:execute-api:us-east-1:860348619467:simzh6y9t2/*/GET/"
    --principal apigateway.amazonaws.com --statement-id 10712fb2-6ee5-4383-9e66-3cddf29e438a
    --action lambda:InvokeFunction
    --region us-east-1

    8. Then varify the alias resouce-based policy is not empty:

    9. Now if you invoke API gateway "TEST" button with stage Variable

    you should be able to see the response

    10. Deploy API Gateway and create `dev`, `test`, `prod` stages. For each deploy, modify stage vairable to its alias

  • 相关阅读:
    Linux-CentOS6.9启动流程排错
    jenkins+maven+svn 自动化部署
    Linux下Mysql5.6 二进制安装
    es的api
    es的QueryBuilder学习使用
    es的QueryBuilders使用
    安装vue的开发环境
    自定义组件
    mounted钩子函数,页面初始化完成此函数加载
    双亲委派机制
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14835465.html
Copyright © 2011-2022 走看看