Skip to content

Is it possible to deploy AWS Amplify app in specific VPC?

0

I'm planning to deploy a Next.js app using AWS Amplify.

My backend is deployed on an EKS cluster within a specific VPC. To optimize for cost and network speed, I want my Next.js app to be in the same VPC, so that server-side data fetching can happen over the internal network.

As far as I know, Amplify uses Lambda functions to handle server-side rendering for Next.js. So, if those Lambda functions can run inside my VPC, they should be able to fetch and process data using the private network.

To summarize, I have two main questions:

  1. Does AWS Amplify support deploying a Next.js app inside a specific VPC?
  2. If it does, will server-side data fetching use the private network?

Thanks.

1 Answer
0

AWS Amplify itself doesn't directly deploy applications within a specific VPC. Amplify is a fully managed hosting service that abstracts away the underlying infrastructure details.

However, there are ways to connect your Amplify-hosted Next.js application to resources in your private VPC:

  1. For Next.js applications with server-side rendering, Amplify uses Lambda functions behind the scenes. You can leverage AWS Lambda with VPC access to act as a bridge between your Amplify app and your backend services in the VPC.

  2. You can set up Lambda functions that have access to your VPC, allowing them to communicate with your EKS cluster over the private network. These Lambda functions can be configured to access resources within your VPC securely.

  3. Another approach is to use VPC endpoints to establish secure connections between your Amplify application and the services within your VPC without exposing them to the public internet.

  4. Since Amplify is built with AWS CDK, you can customize and extend the resources generated by Amplify to connect to virtually any AWS service, including those in your VPC.

For server-side data fetching, if you configure your Lambda functions to have VPC access, they can indeed fetch data over the private network from your EKS cluster, optimizing for both cost and network speed.

To implement this approach, you would need to:

  • Configure security groups appropriately
  • Set up the necessary VPC access for your Lambda functions
  • Ensure proper IAM permissions are in place

This setup allows your Next.js application hosted on Amplify to securely communicate with your backend services in the private VPC.
Sources
How to utilize an ORM to connect to RDS on a private VPC | AWS re:Post
AWS Amplify | Extensible Web & Mobile Apps | Amazon Web Services

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.