A Guide to Amplify CLI - Part 1
In this post, I'll walk you through the process of installing and configuring Amplify CLI.
I assume you already have an AWS account and npm installed on your system.
Topics covered in this post:
1. Installation of Amplify CLI
2. Configure the Amplify CLI
3. List of different Amplify CLI commands
Steps:
1. The Amplify Command Line Interface is a unified toolchain to create AWS cloud services for an application.
2. Let's configure the Amplify CLI:
- To set up Amplify CLI, we have to configure it in order to connect it to our AWS account.
- On CMD, type `amplify configure`
- You will be prompted to sign in to your AWS administrator account and then get redirected to your default web browser. There login with your credentials. After the login is successful, come back to your CMD console.
- Here, specify the AWS region you want to work on. Hit Enter and then you will be asked to complete the user creation process. If you don't know about this process. Read my another blog on this: https://blog.sumitkp.in/2023/03/aws-create-new-user-and-generate-access.html
- After above process is complete, come back to CMD and press Enter to continue. In another prompt, you will be asked to enter access key ID and secret acess key. Copy and paste both of these from your AWS console on your web browser or copy values from csv file you just downloaded.
3. Let's initialize AWS Amplify in our project root.
- After you run command `amplify init`, Enter a name for the project. After you hit enter, you get default values for your new amplify project, such as, App type is JavaScript, environment is dev, default editor is VS Code, ets.
- Select `Yes` to initialize the project with the default configuration, select `No` to change the values.
- Default provider would be `awscloudformation` here. Select the authentication method to use. I have selected `AWS access keys` here where I have to enter `accessKeyId` and `secretAccessKey`.
- Select AWS region of your choice. As `ap-south-1` is closer to my location. I have chosen that. You can any other region also and hit Enter.
4. Some basic amplify commands to use after our amplify has initialized are:
- `amplify status` : This command will show you what you have added already and if it's locally configured or deployed to AWS.
- `amplify add <category>` : This command will allow us to add features like backend API. Different categories that can be added are: analytics, api, auth, function, hosting, interactions.
- `amplify push` : This command will build all your local backend resourcesa and deploy it to the cloud.
- `ampplify console` : This command is used to open the Amplify console and view our project status.
- `amplify publish` : This will build all our local backend and frontend resources and deploy it to the cloud.
Other list of commands that will be covered in this series of post are:
- amplify <category> <subcommand>
- amplify push
- amplify pull
- amplify env <subcommand>
- amplify console
- amplify delete
- amplfy help
- amplify publish
- amplify run
- amplify status
- amplify logout
Category commands for `amplify <category> <subcommand>` are:
- amplify <category> add
- amplify <category> update
- amplify <category> remove
- amplify <category> push
LINK TO AMPLIFY ADD API >>>
Comments
Post a Comment