http.get from async lambda timeout trying to reach public EC2How to get the instance id from within an ec2 instance?Possible reasons for timeout when trying to access EC2 instanceFind region from within an EC2 instanceHow to safely upgrade an Amazon EC2 instance from t1.micro to large?Trying to SSH into an Amazon Ec2 instance - permission errorEC2 instance has no public DNSHow to pass a querystring or route parameter to AWS Lambda from Amazon API GatewayTimeout while launching EC2 instances from AWS LambdaWhy can't an AWS lambda function inside a public subnet in a VPC connect to the internet?Access Issue with Lambda trying to launch ec2 instance
Why did other houses not demand this?
Can diplomats be allowed on the flight deck of a commercial European airline?
Who were the members of the jury in the Game of Thrones finale?
"Official wife" or "Formal wife"?
Are there historical examples of audiences drawn to a work that was "so bad it's good"?
How can I get a refund from a seller who only accepts Zelle?
The disk image is 497GB smaller than the target device
Why is the Eisenstein ideal paper so great?
Possibility of faking someone's public key
Set outline first and fill colors later
Why is this integration method not valid?
Prince of Darkness goes cryptic
Is superuser the same as root?
Negative impact of having the launch pad away from the Equator
What is Orcus doing with Mind Flayers in the art on the last page of Volo's Guide to Monsters?
Is it normal to "extract a paper" from a master thesis?
Is a world with one country feeding everyone possible?
One word for 'the thing that attracts me'?
Why was this character made Grand Maester?
If I arrive in the UK, and then head to mainland Europe, does my Schengen visa 90 day limit start when I arrived in the UK, or mainland Europe?
(For training purposes) Are there any openings with rook pawns that are more effective than others (and if so, what are they)?
Why did it take so long for Germany to allow electric scooters / e-rollers on the roads?
Seeking closure over someone I have unblocked but whom I learned have passed on
How do you earn the reader's trust?
http.get from async lambda timeout trying to reach public EC2
How to get the instance id from within an ec2 instance?Possible reasons for timeout when trying to access EC2 instanceFind region from within an EC2 instanceHow to safely upgrade an Amazon EC2 instance from t1.micro to large?Trying to SSH into an Amazon Ec2 instance - permission errorEC2 instance has no public DNSHow to pass a querystring or route parameter to AWS Lambda from Amazon API GatewayTimeout while launching EC2 instances from AWS LambdaWhy can't an AWS lambda function inside a public subnet in a VPC connect to the internet?Access Issue with Lambda trying to launch ec2 instance
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to figure out what I'm missing in this context.
I have an EC2 running two docker container. One is a python REST api, the other contains nginx which redirect to the python server.
Sending a GET request to my /test endpoint from the browser or postman returns the expected value.
I tried accessing the same public url from an AWS Lambda but the request timeout.
Here's my current situation
- The EC2 url is public and accessible from my browser.
- The Lambda can reach www.google.com sucessfully.
- The Lambda can't reach the EC2 url.
- The Lambda doesn't have a VPC.
- The Lambda is behind an API Gateway (websocket).
- Tried a high timeout value (30sec+).
The issue probably comes from my lack of knowledge of the AWS environment. Can anyone see the problem in the following code?
const AWS = require('aws-sdk');
require('./patch.js');
var http = require('http');
function test(url)
return new Promise((resolve, reject) =>
const req = http.request(url,
(res) =>
let body = '';
res.on('data', (chunk) => (body += chunk.toString()));
res.on('error', reject);
res.on('end', () =>
if (res.statusCode >= 200 && res.statusCode <= 299)
resolve(statusCode: res.statusCode, headers: res.headers, body: body);
else
reject('Request failed. status: ' + res.statusCode + ', body: ' + body);
);
);
req.on('error', reject);
req.write('', 'binary');
req.end();
);
exports.handler = async(event) =>
let googleUrl = "http://www.google.com";
let ec2Url = "XXXXX"; // Public EC2 url
await test(googleUrl).then(function(res)
console.log("Response",res); // This is logged
);
await test(ec2Url).then(function(res)
console.log("Response",res); // This is never logged. Timeout kicked in.
);
return ;
;
javascript amazon-web-services amazon-ec2 aws-lambda
add a comment |
I'm trying to figure out what I'm missing in this context.
I have an EC2 running two docker container. One is a python REST api, the other contains nginx which redirect to the python server.
Sending a GET request to my /test endpoint from the browser or postman returns the expected value.
I tried accessing the same public url from an AWS Lambda but the request timeout.
Here's my current situation
- The EC2 url is public and accessible from my browser.
- The Lambda can reach www.google.com sucessfully.
- The Lambda can't reach the EC2 url.
- The Lambda doesn't have a VPC.
- The Lambda is behind an API Gateway (websocket).
- Tried a high timeout value (30sec+).
The issue probably comes from my lack of knowledge of the AWS environment. Can anyone see the problem in the following code?
const AWS = require('aws-sdk');
require('./patch.js');
var http = require('http');
function test(url)
return new Promise((resolve, reject) =>
const req = http.request(url,
(res) =>
let body = '';
res.on('data', (chunk) => (body += chunk.toString()));
res.on('error', reject);
res.on('end', () =>
if (res.statusCode >= 200 && res.statusCode <= 299)
resolve(statusCode: res.statusCode, headers: res.headers, body: body);
else
reject('Request failed. status: ' + res.statusCode + ', body: ' + body);
);
);
req.on('error', reject);
req.write('', 'binary');
req.end();
);
exports.handler = async(event) =>
let googleUrl = "http://www.google.com";
let ec2Url = "XXXXX"; // Public EC2 url
await test(googleUrl).then(function(res)
console.log("Response",res); // This is logged
);
await test(ec2Url).then(function(res)
console.log("Response",res); // This is never logged. Timeout kicked in.
);
return ;
;
javascript amazon-web-services amazon-ec2 aws-lambda
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12
add a comment |
I'm trying to figure out what I'm missing in this context.
I have an EC2 running two docker container. One is a python REST api, the other contains nginx which redirect to the python server.
Sending a GET request to my /test endpoint from the browser or postman returns the expected value.
I tried accessing the same public url from an AWS Lambda but the request timeout.
Here's my current situation
- The EC2 url is public and accessible from my browser.
- The Lambda can reach www.google.com sucessfully.
- The Lambda can't reach the EC2 url.
- The Lambda doesn't have a VPC.
- The Lambda is behind an API Gateway (websocket).
- Tried a high timeout value (30sec+).
The issue probably comes from my lack of knowledge of the AWS environment. Can anyone see the problem in the following code?
const AWS = require('aws-sdk');
require('./patch.js');
var http = require('http');
function test(url)
return new Promise((resolve, reject) =>
const req = http.request(url,
(res) =>
let body = '';
res.on('data', (chunk) => (body += chunk.toString()));
res.on('error', reject);
res.on('end', () =>
if (res.statusCode >= 200 && res.statusCode <= 299)
resolve(statusCode: res.statusCode, headers: res.headers, body: body);
else
reject('Request failed. status: ' + res.statusCode + ', body: ' + body);
);
);
req.on('error', reject);
req.write('', 'binary');
req.end();
);
exports.handler = async(event) =>
let googleUrl = "http://www.google.com";
let ec2Url = "XXXXX"; // Public EC2 url
await test(googleUrl).then(function(res)
console.log("Response",res); // This is logged
);
await test(ec2Url).then(function(res)
console.log("Response",res); // This is never logged. Timeout kicked in.
);
return ;
;
javascript amazon-web-services amazon-ec2 aws-lambda
I'm trying to figure out what I'm missing in this context.
I have an EC2 running two docker container. One is a python REST api, the other contains nginx which redirect to the python server.
Sending a GET request to my /test endpoint from the browser or postman returns the expected value.
I tried accessing the same public url from an AWS Lambda but the request timeout.
Here's my current situation
- The EC2 url is public and accessible from my browser.
- The Lambda can reach www.google.com sucessfully.
- The Lambda can't reach the EC2 url.
- The Lambda doesn't have a VPC.
- The Lambda is behind an API Gateway (websocket).
- Tried a high timeout value (30sec+).
The issue probably comes from my lack of knowledge of the AWS environment. Can anyone see the problem in the following code?
const AWS = require('aws-sdk');
require('./patch.js');
var http = require('http');
function test(url)
return new Promise((resolve, reject) =>
const req = http.request(url,
(res) =>
let body = '';
res.on('data', (chunk) => (body += chunk.toString()));
res.on('error', reject);
res.on('end', () =>
if (res.statusCode >= 200 && res.statusCode <= 299)
resolve(statusCode: res.statusCode, headers: res.headers, body: body);
else
reject('Request failed. status: ' + res.statusCode + ', body: ' + body);
);
);
req.on('error', reject);
req.write('', 'binary');
req.end();
);
exports.handler = async(event) =>
let googleUrl = "http://www.google.com";
let ec2Url = "XXXXX"; // Public EC2 url
await test(googleUrl).then(function(res)
console.log("Response",res); // This is logged
);
await test(ec2Url).then(function(res)
console.log("Response",res); // This is never logged. Timeout kicked in.
);
return ;
;
javascript amazon-web-services amazon-ec2 aws-lambda
javascript amazon-web-services amazon-ec2 aws-lambda
edited Mar 23 at 23:00
John Rotenstein
82.5k793144
82.5k793144
asked Mar 23 at 21:51
GabbGabb
111
111
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12
add a comment |
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12
add a comment |
1 Answer
1
active
oldest
votes
Turns out I didn't save the security group after editing it.
Check you security group inbound rules if you run into a similar problem.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318737%2fhttp-get-from-async-lambda-timeout-trying-to-reach-public-ec2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Turns out I didn't save the security group after editing it.
Check you security group inbound rules if you run into a similar problem.
add a comment |
Turns out I didn't save the security group after editing it.
Check you security group inbound rules if you run into a similar problem.
add a comment |
Turns out I didn't save the security group after editing it.
Check you security group inbound rules if you run into a similar problem.
Turns out I didn't save the security group after editing it.
Check you security group inbound rules if you run into a similar problem.
answered Mar 24 at 20:25
GabbGabb
111
111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318737%2fhttp-get-from-async-lambda-timeout-trying-to-reach-public-ec2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Increase your Lambda function timeout so that you get a real error -- not the environment-imposed timeout.
– Michael - sqlbot
Mar 24 at 1:38
Increasing the Lambda timeout to >130s gives a "connect ETIMEDOUT" error.
– Gabb
Mar 24 at 11:12