In our microservices architecture powered by Amazon ECS Fargate, the database layer manages and persists product catalog data. This workshop leverages Amazon DynamoDB — a fully managed NoSQL key-value database service that delivers single-digit millisecond latency and seamless automatic scaling.
Under our Infrastructure as Code (IaC) modular design with AWS CDK, DynamoDbStack is defined and provisioned ahead of EcsStack to satisfy dependency requirements:
products table: Configures the partition key as id (AttributeType.STRING).table: dynamodb.Table) so that EcsStack can grant read/write access (grantReadWriteData) to the ECS Fargate Task Role.AWS_PRODUCTSDDB_NAME environment variable, enabling Spring Boot to connect seamlessly.By adopting the On-Demand (PAY_PER_REQUEST) billing mode, the DynamoDB table dynamically scales with request volume and incurs zero idle maintenance costs during lab workflows.
