Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
I can't fetch my data from express server on AWS EC2 to React

I am new to AWS. When I make a fetch request in my React app, I get an error. However, if I connect to the server domain created with aws ec2 or send a GET request with postman, it works fine. As I'm guessing, there seems to be a problem with the security settings of aws ec2. Please someone help me.

Here are some examples

// index.js (express js server)
import express from 'express'

const app = express()

 app.get('/', async (req, res) => {
   res.json({ data: 'hello world' })
 })

 const Port = '80'
 app.listen(Port, () => {
   console.log(`server is running on ${Port}`)
 })
})()

Here is React app.

// App.js (create-react-app example)
// 'localhost:3000' on my computer

export default App() {
const getRankData = async () => {
const response = await fetch(
//                ^^^^^^^^^
// TypeError: Failed to fetch
  "http://ec2-xxx-xxx-xxx-xxx.xxxxx.amazonaws.com/"
);
const myJson = await response.json();
return myJson;
};
// ......

ec2 security settings

/* inbound rules
Security group rule ID: sgr-xxxxx, Type: SSH, Protocol: TCP, Port range: 22, Source:0.0.0.0/0

Security group rule ID: sgr-xxxxx, Type: HTTP, Protocol: TCP, Port range: 80, Source:0.0.0.0/0

outbound rules
Security group rule ID: sgr-xxxxx, Port range: All, Protocol: All, Destination: 0.0.0.0/0 */
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!