The company I work for is an AWS partner and it is natural that many of the applications we build are based on the services offered by Amazon.
We're migrating our CI/CD pipelines to AWS Amplify and I will show you how we can achieve great results with just a few clicks.
The example is based on a Next.js application hosted on GitHub.
To initialize the application we can use the command:
npx create-next-app@latest --typescript
Once the starter is created, we edit the file
pages/index.tsx
replacing the boilerplate with this code:
An environment variable is used here. We have to configure it in the Next.js configuration file
next.config.js
const nextConfig = {
[...]
env: { PROJECT_NAME: process.env.PROJECT_NAME, },
}
module.exports = nextConfig
We can test the app locally by creating a .env.local
file to set the environment variable
After we sync the project with remote GitHub, we're ready to move on to the deployment part.
AWS Amplify
Once logged into the AWS console, let's search for the Amplify service.
Configuration
Click on Host web app
here we can connect our GitHub account and select the project we just created
Click on Next, here we can configure the build and we can set our environment variable
Build & Deploy
π The build and the deployment will be performed automatically
Final result
This is the first article on AWS Amplify, if you find the topic interesting give β€οΈ and I will write more about it. Bye π
You canΒ follow me on Twitter, where I'm posting or retweeting interesting articles.
Top comments (1)
Thanks for giving us this insight and implementation example @gioboa. I find it quite interesting and helpful, so share away!