We perform the following steps to prepare for authentication and file storage with Amplify Gen 2 in the next section:
node -v
npm -v
You need Node.js version 22.12 or later.
You should create an IAM user with the AdministratorAccess-Amplify permission and configure the credentials on your machine with the aws configure command, choosing ap-southeast-1 as the Default region name. Amplify will deploy resources to this region.
git clone https://github.com/Hieu192/FCAJ-Serverless-DMS.git
cd FCAJ-Serverless-DMS
npm install
// Write document information to DynamoDB comment, is already commented out: // Write document information to DynamoDB
// await api.post("/docs", item.info);

We have not created the API yet, so we skip writing to DynamoDB for now. In the next workshop, you only need to uncomment this line after creating API Gateway.
npm run dev
amplify_outputs.json file does not exist yet. This file will be created when we deploy the Amplify backend in the next section.
npm create amplify@latest
@aws-amplify/backend, @aws-amplify/backend-cli, aws-cdk-lib, …) into devDependencies and creates the amplify folder with the following structure:amplify/
├── auth/
│ └── resource.ts
├── data/
│ └── resource.ts
├── backend.ts
├── package.json
└── tsconfig.json

The installation may take a few minutes.
import { defineBackend } from '@aws-amplify/backend';
import { auth } from './auth/resource';
defineBackend({
auth,
});

The backend.ts file is where all backend resources of the application are declared. For now, the backend only has the authentication part (auth). We will add the storage part (storage) in the next section.