API Gateway with EC2 Instance hosted API Integration
I am new to AWS I have hosted my API on EC2 Instance. Imported my API swagger file to Gateway. Now I want to call my EC2 instance API from API gateway how to integrate? should I choose integration type as HTTP, If yes then for each endpoint I have to map it manually in EndPoint section or should I integrate it with my EC2 instance
do you know?
how many words do you know
See also questions close to this topic
-
C# - Adding condition to func results in stack overflow exception
I have a func as part of specification class which sorts the given iqueryable
Func<IQueryable<T>, IOrderedQueryable<T>>? Sort { get; set; }
When i add more than one condition to the func like below , it results in stack overflow exception.
spec.OrderBy(sc => sc.Case.EndTime).OrderBy(sc => sc.Case.StartTime);
The OrderBy method is implemented like this
public ISpecification<T> OrderBy<TProperty>(Expression<Func<T, TProperty>> property) { _ = Sort == null ? Sort = items => items.OrderBy(property) : Sort = items => Sort(items).ThenBy(property); return this; }
Chaining or using separate lines doesn't make a difference.
This problem gets resolved if I assign a new instance of the specification and set it's func, but i don't want to be assigning to a new instance everytime. Please suggest what am i missing here and how to reuse the same instance (if possible).
-
How to get only one question to the preview page in survey management website in angular?
I am using querystring to h=get the questions on preview page but I am not able to get one question on 1st page and 2nd on another page after clicking next button.
Querystring
const queryString = { SurveyId: 1, PageNo: 0, PageSize: 20 };
-
How to add a new Model visually in Mac OS visual Studio
I do not see any choice to create a model in Mac visual studio? I In the windows version the Class created with its imports
using Linq
using Threading.Tasks
using Collection.Generic
-
IIS Web.config Rewrite rules - Redirect rules with - or + chars
https://someserver.com/path01/2011/abc+and+def/88722 https://someserver.com/path01/2011/abc-and-def/88722
I have several URLs that I need to create a redirect rule. I need to remove "2011" from the url and change the URL... I got most of it working but I can't figure out how the "-" or "+" needs to be written and how to combine into one rule
<rule name="Redirection 1" stopProcessing="true"> <match url="test-catalog/([0-9]*)//abc-and-def/([0-9]*)"/> <action type="Redirect" url="https://someserver.com/path01/overview/{R:2}#/abc-and-def"/> </rule> <rule name="Redirection 2" stopProcessing="true"> <match url="test-catalog/([0-9]*)//abc+and+def/([0-9]*)"/> <action type="Redirect" url="https://someserver.com/path01/overview/{R:2}#/abc-and-def"/> </rule>
I tried to use this use rule but it's not working !!
<rule name="Redirection rule " stopProcessing="true"> <match url="test-catalog/([0-9]*)//abc([-+]*)and([-+]*)def/([0-9]*)"/> <action type="Redirect" url="https://someserver.com/path01/overview/{R:4}#/abc-and-def"/> </rule>
Any ideas on how to solve this issue?
-
Windows Server 2022, IIS 10, and SSL - Website is not loading
When my website is installed on Windows server 2016 and 2019 it works perfectly. On Windows Sever 2022 I get an error of "This site can’t be reached The connection was reset" but if I go to IIS -> SSL -> and change client certificates to Ignore instead of Accept or I can go to IIS -> bindings -> port 443 -> select disable TSL 1.3 over TCP it loads up correctly
Can someone explain why this is happening? What Can I do? I don't want to do any of those options
-
Python code stops automatically after 2-4 hours on AWS EC2
i have a python code which runs on my laptop for 24 hours and the same code on EC2 instance stops after couple of hours. This is a code which operates on a broker API and fetches historical data, generates candles and then send trade signals to the broker
-
Assign ELB Account to S3 Bucket Policy
I used the AWS console from the load balancer edit attributes screen and used it to create a bucket to use for access logging. I'm using this policy to form CDK code in typescript to stand up new S3 buckets to use for access logging in higher level environments where I cannot use the console. This is the policy I need to somehow form in typescript CDK code:
"Statement": [ { "Effect":Allow", "Principal": { "AWS": "arn:--ELB-arnstuff--:root" }, "Action": "s3:PutObject", "Resource": "arn:--S3-Bucket-arnstuff--/AWSLogs/123456789/*" } ]
I've managed to get the cdk code figured out to this point:
bucket.addToResourcePolicy( new cdk.aws_iam.PolicyStatement({ effect: awsIam.Effect.ALLOW, principals: //'**This is part I haven't figured out**', actions: ['s3:PutObject'], resources: ['${bucket.bucketArn}/*'] }) );
At this point I don't care if it's hard coded in the CDK, I just need something to help keep the ball rolling forward. Any help is appreciated, thanks
-
AWS API Gateway: Why setting "application/json" mapping template for GET request is required for MOCK integration to work?
I'm setting up a mock integration for GET requests with AWS API Gateway, and wonder why it only works when the
application/json
request template is specified. To my understanding GET request does not have a body and hence does not have a Content-Type header. What is special about 'application/json'? Is this behavior documented somewhere or am I missing some defaults somewhere?Here is terraform code for my API Gateway:
resource "aws_api_gateway_rest_api" "test-api" { name = "test-api" endpoint_configuration { types = ["REGIONAL"] } body = jsonencode(yamldecode(file("openapi.yaml"))) }
openapi: "3.0.1" info: version: "1.0" title: example paths: /test: get: responses: "200": description: demo headers: Content-Type: { schema: { type: 'string' } } x-amazon-apigateway-integration: type: MOCK passthroughBehavior: when_no_templates # the next line is required. # API Gateway returns 500 error if I remove it. why? # API Gateway returns 415 error if I change application/json to text/plain. why? requestTemplates: { 'application/json': '{"statusCode": 200}' } responses: default: statusCode: 200 responseParameters: { 'method.response.header.Content-Type': "'text/plain'" } responseTemplates: {'text/plain': 'hello'}
Here is an example log output when requestTemplates is set to
{ 'text/plain': '{"statusCode": 200}' }
Execution log for request 09c6d06b-669c-4717-86a2-c8489136f760 Fri May 06 14:28:24 UTC 2022 : Starting execution for request: 09c6d06b-669c-4717-86a2-c8489136f760 Fri May 06 14:28:24 UTC 2022 : HTTP Method: GET, Resource Path: /test Fri May 06 14:28:24 UTC 2022 : Method request path: {} Fri May 06 14:28:24 UTC 2022 : Method request query string: {} Fri May 06 14:28:24 UTC 2022 : Method request headers: {} Fri May 06 14:28:24 UTC 2022 : Method request body before transformations: Fri May 06 14:28:24 UTC 2022 : Execution failed: null Fri May 06 14:28:24 UTC 2022 : Method completed with status: 415
-
Correct way to auto create aws api gateways to existing apis
I am building 2 separate nodejs microservices (using express inside each etc).
What is the correct way to properly automate creation of AWS Api gateway's so that they map exactly on to my nodejs apis ?