aws-api-gateway

How do I pass arguments to AWS Lambda functions using GET requests?

妖精的绣舞 提交于 2019-12-03 10:51:15
Say I want to pass val1 and val2 in the URL string when making a GET request from my Api gateway endpoint to my Lambda function: https://xyz.execute-api.amazonaws.com/prod/test?val1=5&val2=10 And I have a simple function that sums the two inputs, val1 and val2: def lambda_handler(event, context): # How do I get at val1 and val2?? return {'result': val1 + val2} I've added val1 and val2 to URL Query String Parameters on the Method Request on the AWS API Gateway. But how do I access them inside the function? After defining the query string parameters in Method Request section of the API Gateway,

How do I find the API endpoint of a lambda function?

流过昼夜 提交于 2019-12-03 10:06:54
I have a Lambda function that has an exposed API Gateway endpoint, and I can get the URL for that via the AWS console. However, I would like to get that URL via API call. Neither the Lambda API documentation nor the API Gateway documentation seem to have that information (or perhaps I've missed it), so is this even possible in the first place? Your API Gateway endpoint URL doesn't get exposed via an API call. However, since the URL of the API follows a certain structure, you could get all the necessary pieces and create the URI within your code. https://API-ID.execute-api.REGION.amazonaws.com

Terraform not deploying api gateway stage

天大地大妈咪最大 提交于 2019-12-03 09:39:30
I have been trying to create an API Gateway endpoint using terraform. Everything seems to be working except the last part of deploying a stage. After I run terraform apply I go into the console and I find that the deployment has not happened. I need to manually click on Deploy Api in order to get it working. Here's the terraform file for the api gateway. variable "region" {} variable "account_id" {} resource "aws_api_gateway_rest_api" "online_tax_test_client_report_endpoint_api" { name = "online_tax_test_client_report_endpoint_api" description = "The endpoint that test has to hit when new

Is there a best approach to deploy an architecture to send SMS using a Microservice model?

馋奶兔 提交于 2019-12-03 08:51:45
问题 We have a service within a Backend class, the service looks like: // Setup AWS SNS AWS.config.update({ region: 'eu-west-1', accessKeyId: process.env.AWS_ACCESS_KEY_ID, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY }); var sns = new AWS.SNS(); var params = { Message: "SMS message test", MessageStructure: 'string', PhoneNumber: '0045xxxxxxxx', Subject: 'Alarm', MessageAttributes :{ 'AWS.SNS.SMS.SenderID': { 'DataType': 'String', 'StringValue': 'MySender' }, 'AWS.SNS.SMS.SMSType':

Regional API Gateway with CloudFront

旧时模样 提交于 2019-12-03 08:48:03
问题 Amazon released new feature - to support regional api endpoints Does it mean I can deploy my same API code in two regions which sends request to Lambda micro-services? (It will be two different Https endpoints) And have CloudFront distribute the traffic for me? Any code snippets? 回答1: Does it mean I can deploy my same API code in two regions which sends request to Lambda micro-services? (It will be two different Https endpoints) This was already possible. You can already deploy the same API

Setup a basic WebSocket mock in AWS ApiGateway

别等时光非礼了梦想. 提交于 2019-12-03 08:41:48
I am trying to setup an extremely simple WebSocket mock within AWS ApiGateway. However, every attempt I've tried gives me an error: 13:36:52 (X33uOGUfIAMFq7w=) Extended Request Id: X33uOGUfIAMFq7w= 13:36:52 (X33uOGUfIAMFq7w=) Verifying Usage Plan for request: X33uOGUfIAMFq7w=. API Key: API Stage: redacted/prod 13:36:52 (X33uOGUfIAMFq7w=) API Key authorized because route '$connect' does not require API Key. Request will not contribute to throttle or quota limits 13:36:52 (X33uOGUfIAMFq7w=) Usage Plan check succeeded for API Key and API Stage redacted/prod 13:36:52 (X33uOGUfIAMFq7w=) Starting

AWS API Gateway: limit requests from a single IP

China☆狼群 提交于 2019-12-03 08:40:04
问题 Does AWS API Gateway allows limiting a number of requests from a single IP? I'm building a public API and would like to prevent it from being abused by establishing a limit on a number of times the API can be called from a single IP address (like 100 requests per minute). Thanks, 回答1: AWS API Gateway does not offer the functionality that you are looking for but there is a workaround. What you can do is Integrate AWS API gateway with AWS Cloud Front and use AWS Web Application Firewall Rules

How do I cloudform an API gateway resource with a lambda proxy integration

╄→尐↘猪︶ㄣ 提交于 2019-12-03 05:55:41
I've been trying to work out how to express (in cloudformation) an API Gateway Resource that has a Lambda function integration type using the Lambda Proxy integration. This is easy to do in the AWS console as there is a check box that you can select: However there is no corresponding field in the AWS::ApiGateway::Method CloudFormation resource (it should be in the Integration property ). How can I configure this in cloudformation? The Integration type should be set to AWS_PROXY . An example snippet of a method from a working YAML CloudFormation template is below. ProxyResourceAny: Type: AWS:

AWS API Gateway error: API Gateway does not have permission to assume the provided role as S3 proxy

送分小仙女□ 提交于 2019-12-03 05:46:34
问题 There are similar questions but they have answers that I have tried. I'm not sure what I could be doing wrong but any help would appreciated. Test details: The Error from a method-execution test; PUT request: Execution log for request test-request Mon Oct 16 10:13:47 UTC 2017 : Starting execution for request: test-invoke-request Mon Oct 16 10:13:47 UTC 2017 : HTTP Method: PUT, Resource Path: /pop-data-xmlz/test.xml Mon Oct 16 10:13:47 UTC 2017 : Method request path: {item=test.xml, folder=pop

CloudFormation doesn't deploy to API gateway stages on update

别说谁变了你拦得住时间么 提交于 2019-12-03 05:34:09
问题 When I run CloudFormation deploy using a template with API Gateway resources, the first time I run it, it creates and deploys to stages. The subsequent times I run it, it updates the resources but doesn't deploy to stages. Is that behaviour as intended? If yes, how'd I get it to deploy to stages whenever it updates? (Terraform mentions a similar issue: https://github.com/hashicorp/terraform/issues/6613) 回答1: Seems like there is no way to easily create a new Deployment whenever one of your