I am a newbie in using AWS Amplify and I just published my own frontend WebApp with it developed with React. I just zipped my build folder and dropped the resulting zip file in the AWS Console. It is working fine.
However, the job is done manually and I want to automate that. I have CI&CD servers other than the ones in AWS which are working fine for my other services. So what I need is a script to automate what I just did as a I want to reuse my existing CI&CD servers. Having such a script will be really useful as I can reproduce the steps locally or in a docker container.
I know that there is a solution for that: the amplify CLI. However, commands such as amplify init
, amplify configure
and amplify pull
require a lot rights and a lot of user interaction even the AWS profile (with the secret key and access key) has already been configured.
It would be great to do something like this:
amplify deploy build.zip <APP-ARN>
or (in case of a folder)
amplify deploy /build <APP-ARN>
Essentially, I just want to automate what I did manually: uploading the (zipped) build folder to deploy my AWS Amplify app. Thus, this means no user interaction.
How to do this?
Your solution is git, aws amplify has the ability to watch a git repo and detect changes. If there is a change to the branch that you have set it to watch, it will automatically build a new version.
You can set it up to build only frontend or both backend (amplify) and frontend.
Create a git repo. You can use for example github or aws codecommit
Configure your project to publish to that git repo
In AWS Amplify console start a new app or change your existing one, to watch the git repo
Publish changes to the git repo and watch in the amplify console that it automatically builds a new version of your app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With