#I'm certain some of the stuff I'm
1 messages · Page 1 of 1 (latest)
I'm literally here looking for answers to my problems with my production build in Azure. So what is the issue with your prod build?
You can deploy nextjs to amplify pretty seamlessly
(If you aren’t using app dir)
If you are there’s a bit more config
Mostly connections, ports, headers, et cetera. The biggest issues we're dealing with right now are running a build and having it connect to our API to generate static pages (it needs a list of records for several pages to generate dynamic pages). We've been trying several ways to set up servers, either through an EC2 instance of frontend that connects to EC2 backend or connecting EC2 backend using Amplify frontend
@royal merlin my issue with Amplify isn't the deploy it is setting up EC2 to accept connections from Amplify
Oh
Well that’s not really a nextjs thing
You gotta make the ec2 publicly accessible
I'm aware, I just don't know how to find a solution. Pretty much trying to look everywhere at this point because I'm not a devops engineer
Because amplify can’t talk to private ec2 instance
If I could whitelist the Amplify instance that would be ideal, but there's no where to get an IP of the instance
I don't think it's feasible to open our API to public without any authentication
So it’s not possible to whitelist it
It’s not, you gotta add auth 👍
That could be something as simple as a hardcoded key that gets sent as a header
And you confirm in the api that the key matches the predicted env variable
I see. I guess I will need to look into that.
Good luck.
So setting up a key as a header using next.config.js that is verified by the backend could be the way that is setup?
thanks for that @royal merlin - I'll be trying aws soon
Idk about next.config
I mean when sending requests to your api
Include the key in the headers
Ah, in request headers okay, that makes sense.
Where the key comes in terms of env variables and how it gets injected into your app is up to you
Yeah, does Amplify have a way to use the secrets manager like EC2 instances do?
Anything on aws can access the secret manager
But it may not always be obvious how via their ui
You can add env variables to amplify via their ui but they don’t go into secrets manager
If you want to use secrets manager you gotta name the keys using a certain pattern so amplify knows how to pick it up. Google for it
Or you can access the secret manager programmatically inside of your next config
And load the secrets during build time
Yeah, so our .env file usually gets records during the server build in EC2 using linux commands to just echo the variables from the secrets m anager
Using the aws JavaScript api