I've just used AWS Amplify to create my react frontend and AppSync API which is nice. I have a spring batch project that I've deployed to ec2 using elastic beanstalk and codepipeline which works fine.
I can also call the REST endpoints on postman but the problem is how do I programmatically update the API endpoint URL in my frontend project given that I do terminate and re-create the elastic beanstalk environment on a daily basis?
Based on the comments.
You sadly can't add ssl to myrestapi.ap-southeast-2.elasticbeanstalk.com
. The reason is that this is domain controlled by AWS. You can only request SSL certificates for domains that you control (i.e. own):
Before ACM issues a certificate, it validates that you own or control the domain names in your certificate request. You can use either email validation or DNS validation.
Thus if you want to have ssl for your EB, you need to have your own domain. You can get one from Route53
:
If you are constantly changing your EB, its URL will be changing as well. Thus you would need to setup some automation procedure to update the record set in Route53 to new url. There are examples for that, though they would need to be adapted specifically to your use-case: