💻
Building and hosting a WebApp
  • Getting started
  • Project setup
    • Requirements
    • Files organisation
    • Lerna
    • Linter
    • Prettier
    • GitHook
    • Testing
    • Conclusion
  • Backend
    • Files organisation
    • Environment config
    • Express API
    • Security
    • Database
    • GraphQL
    • User authentication
    • Conclusion
  • Frontend
    • Create React App
    • Files organisation
    • Styles
    • Apollo Hooks
    • Form management
    • User authentication
    • Writing tests
    • Types generation
    • Conclusion
  • DevOps
    • CI/CD
    • AWS
      • Managing secrets
      • Pricing
      • RDS
      • S3
      • Route53
      • CloudFront
      • Serverless
      • Security
      • CloudFormation
    • Conclusion
  • 🚧Stripe payment
  • 🚧File upload
Powered by GitBook
On this page
  • VPC
  • Subnets
  • IP address whitelisting
  • Network architecture

Was this helpful?

  1. DevOps
  2. AWS

Security

PreviousServerlessNextCloudFormation

Last updated 5 years ago

Was this helpful?

The database shouldn't be available on the internet. It should always be accessed via the API. This is the default configuration with Aurora, but this applies to any production database you'll run in the future.

To achieve this, we will use Subnets within our VPC.

VPC

The VPC is the main container that contains everything for our app. If we had another app, it would be in another VPC.

Subnets

Subnets are used to separate resources within a VPC. You can have subnets accessible from the internet (public) and subnets only accessible internally with rules (private).

The database will be in a private subnet, We are going to accept traffic from the internet via a public subnet and send it to our API.

IP address whitelisting

When building a scalable infrastructure, you need to be able to add and remove instances when needed. But this also means, the IP addresses of the instances are random and can change anytime.

When using lambda, we simple don't have any IP address.

Network architecture

More info:

The rule are set using . E.g Resource A can access Resource B on port 5432.

When using a 3rd party, you should always have a of IP addresses. This way, only the intended resources can access it.

How do we know which IP address to whitelist then? We could whitelist all the . It's a start but that's not enough.

The solution is to buy an attached to an . Set the outbound traffic (such as request to 3rd parties) to go through the Internet Gateway and use its IP address.

Security Groups
whitelist
AWS IP addresses
Elastic IP address
Internet Gateway
Internet Gateway
How do I give internet access to my Lambda function in a VPC?
VPC and subnets
Always run different apps in their own VPCs to improve security.