aws-api-gateway

Authenticate app to AWS API Gateway with Cognito

℡╲_俬逩灬. 提交于 2019-12-05 06:19:05
问题 Following is my use case - I am developing an android app. I am trying to use aws api gateway and a lambda function at back of it. but even before i login i want to secure the HTTP calls and authenticate my application. For that i am planning to use cognito with the API Gateway. so first my call will go to cognito which will authenticate the application(not user) and then my call will go to any Lamda function. I want to include all of this in the SDK of api gateway. Ques 1 - Is it even

How to generate Options(CORS) with Swagger

流过昼夜 提交于 2019-12-05 06:02:34
For a project we are working on we are generating an Swagger File automatically. However at this moment we are struggling with the CORS part. We are using the Amazon API gateway import api functionality. To use this in combination with Swagger and CORS, we have to create an additional action (operation) in our source code which allows CORS(options) for each api method (operation)! eg: [HttpOptions] [Route("{id}")] [ProducesResponseType((int)HttpStatusCode.OK)] public IActionResult UserOptions() { return new OkResult(); } As you can see this makes the code a lot dirtier. this is a temporary fix

AWS API Gateway - CORS “access-control-allow-origin” - multiple entries

只愿长相守 提交于 2019-12-05 05:18:24
I have a AWS Lambda instance that connects to a defined AWS API Gateway. If I enable CORS and give the access-control-allow-origin a definition of http://example.com , then I am able to access the Lambda instance from http://example.com . However, if I use https://example.com , it doesn't work. So in AWS, how can I define using multiple access-control-allow-origin values without using a wildcard? I tried using something like *.example.com , but that doesn't work. EDIT: If I use '*' as my value on the API gateway, but setup CORS rules on my S3 bucket, would that be secure? Example for bucket

Access AWS API Gateway with IAM roles from Python

帅比萌擦擦* 提交于 2019-12-05 03:27:25
I have an AWS API Gateway that I would like to secure using IAM Roles . I am looking for a package to help me accessing it using Python. I am trying to avoid implementing the entire Version 4 Signing Process . I am sure there must be some library I can use. I looked into aws-requests-auth but it requires a "aws_service" to generate the signature. I looked also to boto3 but I am not able to find any way to just add authentication headers to a general request. You can use aws-requests-auth to generate the signature for your request to API Gateway with execute-api as the service name. import

Export existing AWS Lambda and API Gateway to Cloudformation template

*爱你&永不变心* 提交于 2019-12-05 02:22:24
How to export existing configured and tested infrastructure (including AWS Lambda functions, API Gateways, ElastiCache clusters, Cloudwatch rules) to Cloudformation template? I know about Cloudformer tool, but it supports limited number of AWS services (Amazon VPC, DynamoDB, etc) and don't supports some of services which we use. Which tools and approaches can I use in my case for generating Cloudformation template? Partial solution: there is ability to export Lambda function to AWS SAM file and then We will get YAML file which describes your Lambda function as 'AWS::Serverless::Function'. But

How to open anonymous access to AWS API Gateway resource

拈花ヽ惹草 提交于 2019-12-05 00:36:01
问题 I have a number of lambda functions exposed via the AWS Gateway Service as such: - /some-resource GET POST OPTIONS - /some-other-resource GET POST OPTIONS - /some-public-resource GET OPTIONS The resources are secured with Access Tokens. However, I would like to allow anonymous access to the /some-public-resource resource, so that it can be accessed without requiring any authentication. I have tried to create a policy in IAM for that resource's ARN (although I am not sure that I got the

Access headers in AWS API Gateway using HTTP Proxy?

馋奶兔 提交于 2019-12-04 23:45:10
问题 I'm using AWS API Gateway and it's HTTP Proxy, I need to pass Authorization header to my endpoint through AWS API Gateway Things I've tried: Setting Method Request like so, Integration Request setup This doesn't work, my app doesn't receive the Authorization header, Also I've tried using mapping template { "method": "$context.httpMethod", "body" : $input.json('$'), "headers": { #foreach($param in $input.params().header.keySet()) "$param": "$util.escapeJavaScript($input.params().header.get(

Is it possible to query an Amazon RDS instance directly from API Gateway?

大兔子大兔子 提交于 2019-12-04 23:13:36
I'm new to API Gateway, and as far I have tried is a really powerful tool. For the project I'm working right now we are using a PostgreSQL instance in RDS. I've seen that is possible to access directly to DynamoDB tables from API Gateway, so I was wondering if is there a way to do so for relational databases. So I created a resource with a GET method and configure it to connect to my database, but I wasn't sure if I used the right parameters: Provided information about the target backend So I wasn't sure about the arguments in each setting's field. In AWS Subdomain I wrote the public URL as if

AWS Lambda - Unable to connect to SQL Server RDS

可紊 提交于 2019-12-04 19:28:46
Hi I was having the same problem as this post but the posted answer (no sample code) wasn't provided so I will start a new thread and ask you guys. I have created a AWS Serverless Application (.Net Core) project for our lambda function and below code is what I used to connect in AWS RDS. string ConnectionString = "Data Source=rds4abc1190.asdfqwerqb9l.us-east-1.rds.amazonaws.com,2855;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=myID;Password=mypassword;Encrypt=False"; using (var Conn = new SqlConnection(ConnectionString)) { using (var Cmd = new SqlCommand("SELECT * from

CloudFormation API Gateway CORS issue access to XMLHttpRequest blocked

自作多情 提交于 2019-12-04 19:25:32
I'm trying to use CloudFormation to create an API Gateway but I have CORS issue with it. Error on the front-end: POST https://<>.execute-api.us-east-1.amazonaws.com/prod/<> 500 new:1 Access to XMLHttpRequest at '<>' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. The API is created without any issue and I even double check every single page on the console against the working API and find no differences in their Method Request , Integration Request , Integration Response and Method Response for