# SecureCart

## SecureCart Organizational Structure & AWS Access Roles

<details>

<summary>SecureCart Organizational Structure &#x26; AWS Access Roles</summary>

SecureCart is a cloud-native e-commerce company operating on AWS. To ensure secure and efficient access to AWS resources, we must define who needs access, what they need access to, and how to control access using AWS Identity and Access Management (IAM).

This document outlines SecureCart’s organizational structure, the roles that require AWS access, and the appropriate IAM permissions model to follow.

***

## **SecureCart Organizational Structure**

SecureCart consists of multiple **business units** and **technical teams** that interact with AWS resources in different ways. The key organizational units include:

### **Executive & Management**

1. **Chief Technology Officer (CTO)**
   * Provides **high-level oversight** of AWS operations.
   * Requires **read-only access** to AWS **billing & cost management**.
2. **Finance & Billing Team**
   * Monitors **AWS costs, budgets, and consolidated billing**.
   * Requires **access to AWS Cost Explorer, AWS Budgets, and AWS Billing**.

***

### **Engineering & Development**

3. **DevOps & Cloud Engineering Team**
   * Manages **infrastructure, deployments, and monitoring**.
   * Requires **full access to AWS services related to infrastructure** (e.g., IAM, EC2, VPC, S3, RDS, EKS, ECS, CloudFormation, Route 53).
   * **Least privilege principle:** Admin access only within the sandbox and non-prod environments.
4. **Software Development Team**
   * Builds and maintains **e-commerce applications** running on AWS.
   * Requires **limited access** to AWS services such as:
     * **Read-only access** to production logs and metrics (CloudWatch, X-Ray).
     * **Deploy permissions** for non-prod environments.
     * No access to **IAM or networking**.
5. **Data Engineering & Analytics Team**
   * Works with **data pipelines, analytics, and reporting**.
   * Requires access to:
     * **Amazon Redshift, DynamoDB, RDS, and Athena**.
     * **S3 data lakes for raw and processed data**.
     * **AWS Glue & Lambda** for data processing.
     * No access to **networking, IAM, or compute instances**.

***

### **Security & Compliance**

6. **Security & Compliance Team**
   * Manages **security policies, threat detection, and compliance audits**.
   * Requires:
     * **Full IAM permissions to review and manage security policies**.
     * **Read access to AWS Security Hub, AWS GuardDuty, AWS Macie**.
     * **Access to AWS CloudTrail logs and IAM Access Analyzer**.
   * No permissions to **modify compute, database, or storage resources**.

***

### **Operations & Support**

7. **Customer Support Team**
   * Assists customers by accessing **order information, product details, and system health**.
   * Requires **read-only access to Amazon DynamoDB (customer and order data)**.
   * **No write access to any AWS service**.
8. **Product Management Team**
   * Works with engineering to define and test features.
   * Requires **read-only access to AWS CloudWatch logs and dashboards** for monitoring.
   * **No access to IAM, compute, or storage resources**.

***

## **AWS Access Requirements by Role**

<table data-header-hidden><thead><tr><th></th><th width="232"></th><th></th></tr></thead><tbody><tr><td><strong>Role</strong></td><td><strong>Access Level</strong></td><td><strong>AWS Services Required</strong></td></tr><tr><td><strong>CTO</strong></td><td>Read-only</td><td>AWS Billing, Cost Explorer, Budgets</td></tr><tr><td><strong>Finance Team</strong></td><td>Billing &#x26; Cost Access</td><td>AWS Billing, AWS Cost Explorer</td></tr><tr><td><strong>DevOps Team</strong></td><td>Full Admin (Non-Prod), Restricted Admin (Prod)</td><td>IAM, EC2, VPC, RDS, CloudFormation, Route 53</td></tr><tr><td><strong>Software Developers</strong></td><td>Limited (Deploy Only)</td><td>ECS, Lambda, API Gateway, DynamoDB, CloudWatch</td></tr><tr><td><strong>Data Engineers</strong></td><td>Full Access to Data Services</td><td>Redshift, S3, Glue, DynamoDB, Athena</td></tr><tr><td><strong>Security Team</strong></td><td>Full Security Admin</td><td>IAM, GuardDuty, Security Hub, CloudTrail</td></tr><tr><td><strong>Customer Support</strong></td><td>Read-Only</td><td>DynamoDB (customer and order data)</td></tr><tr><td><strong>Product Management</strong></td><td>Read-Only</td><td>CloudWatch, DynamoDB</td></tr></tbody></table>

</details>

## Features

<details>

<summary>Product Catalog</summary>

## Product Catalog

Provides detailed product information, including names, prices, descriptions, images, and availability status, and drives customers' catalog views. It integrates with essential services like Cart, Order, Inventory, and Pricing to ensure users always see up-to-date product details, stock availability, and pricing information. Utilizing AWS services such as DynamoDB, OpenSearch, S3, and ECS Fargate delivers a scalable, responsive catalog experience that supports product discovery, user engagement, and seamless shopping.

***

#### AWS Services Involved

* Amazon ECS Fargate: ECS Fargate is responsible for running containerized services that handle the business logic for the Product Catalog Microservice. It processes API requests to retrieve product-related information and handles complex operations such as filtering, sorting, and aggregating product data. This setup ensures scalability and allows the microservice to manage high traffic volumes effectively.
* Amazon Aurora: Manages relational data for products, supporting complex queries and ensuring data consistency across related entities, such as categories, brands, and product hierarchies.
* Amazon OpenSearch Service: Powers search functionality, enabling users to find products through flexible queries, including full-text search and filtering.
* Amazon ElastiCache (Redis): Caches frequently accessed product details, optimizing response times by reducing database query load and enhancing overall performance.
* Amazon S3: Stores product images, media files, and other assets, providing scalable storage and quick access to media resources that enrich the catalog and user experience.

</details>

<details>

<summary>Review and Ratings Service</summary>

The Review and Ratings Service lets customers leave feedback, reviews, and product ratings. This service collects, stores, and displays reviews and star ratings, enhancing product pages and helping potential customers make informed purchasing decisions.

***

#### AWS Services Involved

* AWS Lambda:
  * Manages request processing for all review actions, including posting new reviews, validating content, and editing or updating existing reviews.
  * Publishes events to Amazon MSK for Kafka) when a new review is added, or an existing review is modified.
  * Consumes these Kafka events to recalculate the average ratings for the corresponding product.
  * Publishes the updated product ratings to a Kafka topic, enabling downstream systems like the Product Catalog Microservice to synchronize product rating updates.
  * Performs automated checks for flagged or inappropriate content, with suspicious reviews queued for further moderation if necessary.
* Amazon MSK for Kafka:
  * Acts as the backbone of the event-driven architecture by enabling reliable communication between the Review and Ratings Service and downstream services.
  * Handles review events (creation, updates, deletions) and publishes recalculated product ratings to appropriate topics for real-time processing by other microservices.
  * Ensures scalability and fault tolerance for handling high volumes of review and rating events.
* Amazon DynamoDB:
  * Stores review and rating data, such as customer IDs, product IDs, review text, and star ratings, enabling quick and efficient access to review information for each product.
* Amazon S3:
  * Stores media files associated with reviews, such as user-uploaded images or videos, providing scalable storage for rich media content in reviews.
* Amazon OpenSearch Service (or Elasticsearch):
  * Indexes review data to enable full-text search, filtering, and sorting capabilities.
  * It supports features like filtering reviews by star rating or displaying recent reviews first, enhancing users' search and discovery experience.

</details>

<details>

<summary>Cart Service </summary>

The Cart Service allows users to add, update, and remove products in their shopping cart. It manages the cart’s contents, calculates totals, applies discounts, and provides a seamless shopping experience by tracking selected items until checkout.

Through its dependencies on the Product Catalog, Pricing, and Inventory services, the cart service keeps cart data current and helps facilitate a smooth transition from selection to checkout. Integrating with analytics, recommendations, and notifications also allows the Cart Service to enhance customer engagement, optimize the shopping journey, and reduce cart abandonment rates.

***

#### AWS Services Involved

* Amazon DynamoDB: Stores cart data, including items, quantities, prices, and user associations. It provides quick access to cart information and allows real-time updates as users add or remove items.
* Amazon MSK for Kafka: Manages asynchronous cart-related tasks, such as handling bulk updates for discounts or notifying other services of cart updates. This ensures smooth processing even during peak traffic.
* AWS Lambda: Processes events related to cart updates, such as adding items, removing items, or applying discounts. Lambda can also help keep the cart in sync with inventory changes by removing unavailable items.
* Amazon ElastiCache (Redis): Caches frequently accessed cart data for fast retrieval, especially for high-traffic scenarios. This improves cart responsiveness by reducing the need to query DynamoDB repeatedly.

</details>

<details>

<summary>Wishlist Service</summary>

The Wishlist Service allows users to save products for future reference, providing a convenient way to track items of interest without immediately adding them to the cart. It helps enhance the user experience by allowing customers to curate lists of products they may want to purchase later, promoting customer engagement and potential future sales.

The Wishlist Service depends on the Product Catalog, Inventory, and Pricing services to ensure current product information, availability, and pricing. Integrating with the Notification and Recommendation services keeps users engaged and encourages conversions through timely alerts and product suggestions.

***

#### AWS Services Involved

* Amazon DynamoDB: Stores wishlist data, including product IDs, user IDs, and timestamps. DynamoDB enables quick access to wishlist items, supporting real-time updates and retrieval as users add, view, or remove items from their wishlist.
* Amazon MSK for Kafka: Manages tasks related to wishlist updates, such as queuing notifications for price changes or low-stock alerts. This ensures timely event processing even during peak traffic times.
* AWS Lambda: Processes events related to wishlist updates, such as adding or removing items, notifying users of price changes, or removing discontinued items. Lambda functions enable serverless event handling, enhancing the wishlist feature's scalability.
* Amazon ElastiCache (Redis): Caches frequently accessed wishlist data for faster retrieval, especially during high-traffic periods. This improves performance and reduces the load on DynamoDB.

</details>

<details>

<summary>Inventory Management</summary>

Tracks and manages product stock levels and availability across the e-commerce platform. It ensures that inventory is accurately updated, monitored, and accessible for various business operations, such as order processing, restocking, and product catalog updates. It depends on the order, cart, product management, and pricing services. The integration of AWS services such as DynamoDB, Aurora, Lambda, SQS, and Kafka ensures scalable, real-time inventory tracking and management, making the platform responsive to changes in demand and supply.

***

**AWS Services Involved**

* Amazon ECS Fargate: Core business logic for managing inventory, such as processing reservations, managing stock availability, calculating inventory thresholds, and handling replenishment workflows. Additionally, it consumes events for event-driven processing for tasks such as adjusting stock levels in response to purchases, returns, or restocking events. This allows real-time updates to inventory levels across the system.
* Amazon DynamoDB: The primary datastore for frequently accessed inventory information, such as real-time stock levels and product availability. DynamoDB provides high-speed, low-latency access, making it ideal for quick lookups during order placements or catalog updates. It is used for high-throughput operations where inventory data must be quickly accessible without complex joins, such as product catalog or cart service inquiries.
* Amazon RDS: Stores relational data for inventory management, such as detailed stock records, supplier information, warehouse data, and historical inventory transactions. RDS provides strong support for SQL queries, enabling complex reporting and analytics.
* Amazon S3: Stores related inventory data files, such as bulk inventory imports, stock history, and reports, providing scalable storage for logs and historical records.
* Amazon SQS (Simple Queue Service): Acts as a message queue for inventory-related tasks requiring reliable, task-based processing. SQS is well-suited for use cases where messages are processed independently, and ordering is less critical, such as asynchronous, one-off events.
  * Events Published to SQS:
    * Inventory Restock Events: When a product's inventory is replenished, SQS can queue restock messages for downstream systems to update stock counts.
    * Order Fulfillment and Reservation Events: When an order is placed, SQS can handle stock reservation messages to confirm product availability or queue messages for stock adjustments post-purchase.
    * Backorder Notifications: If a product goes out of stock and is placed on backorder, SQS can queue these notifications for the fulfillment system or customer service.
    * Inventory Adjustment Requests: SQS can queue adjustment requests to increment or decrement inventory counts for cases like returns or manual adjustments.
  * Benefits of SQS for These Events: SQS ensures high reliability in message delivery, handles retry policies, and allows asynchronous processing of these discrete tasks without requiring real-time streaming.
* Apache Kafka (or Amazon MSK): Manages real-time inventory streaming events that require high-throughput, low-latency processing. Kafka excels at publishing events that must be processed in real-time or consumed by multiple systems simultaneously.
  * Events Published to Kafka:
    * Real-Time Stock Level Changes: As stock levels change (due to orders, returns, or other adjustments), Kafka streams these events to consumers in real-time.
    * Threshold-Based Inventory Alerts: Kafka handles events triggered by specific inventory thresholds, such as low-stock or out-of-stock notifications, and streams these to analytics or alerting systems.
    * Inventory Analytics and Forecasting Events: Kafka streams stock change events to analytics or forecasting services that monitor patterns or trends in inventory usage and demand.
    * Inventory Synchronization and Audit Logs: Kafka can store events related to all stock changes, creating a real-time audit trail that various downstream systems can consume or replay for analytics or compliance purposes.
  * Benefits of Kafka for These Events: Kafka’s real-time streaming, partitioning for parallelism, and multiple consumer capabilities make it ideal for high-volume events and cases where multiple systems need the same data, such as analytics, alerting, and monitoring.

</details>

<details>

<summary>Pricing and Discounts</summary>

Manages and calculates product prices, discounts, promotions, and dynamic pricing adjustments. It ensures that the latest prices and applicable discounts are displayed across the platform, enabling a consistent pricing experience for users.

It depends on the Product Catalog, Cart, Order, and Inventory services to ensure accurate and consistent user pricing from product listing to checkout. Its integration with Notification and Analytics services to drive user engagement and optimize promotional strategies.

***

#### AWS Services Involved

* Amazon DynamoDB: Stores pricing rules, discount configurations, and promotion details for fast access during pricing calculations.
* Amazon ElastiCache (Redis): Caches frequently accessed pricing data to ensure quick response times for high-traffic queries, especially during promotional events. This improves performance by reducing the load on DynamoDB.
* AWS Lambda: Processes inventory-based events (e.g., low or high stock levels) to trigger pricing updates or apply specific discount rules dynamically. Calculates the price of respective products from the cart based on rule records defined in DynamoDB

</details>

<details>

<summary>Order Management</summary>

The Order Management Service handles the end-to-end processing of customer orders. It manages order creation, updates, payment processing, status tracking, and order history, ensuring a seamless experience from when an order is placed to when it is fulfilled and delivered. The service is crucial in coordinating with other services to handle inventory, billing, and fulfillment.

Coordinating with services like cart, inventory, payment, and shipping delivers a seamless experience from checkout to delivery. AWS services like DynamoDB, Lambda, SQS, and RDS enable scalable, resilient order management, supporting high transaction volumes and real-time updates.

***

* Amazon ECS Fargate: Handles essential CRUD operations, such as creating, updating, and retrieving orders. In order creation, it receives, validates, and stores order details while managing order status updates across stages like pending, shipped, or completed. It retrieves and displays order details for customers or internal requests. It performs inventory checks and manages reservations by interacting with other services.
* Amazon DynamoDB: Stores order details, status updates, and customer-specific order history, enabling quick retrieval of order information for tracking and customer service inquiries.
* AWS Lambda: Triggered to generate invoices when an order is completed, which involves creating a PDF based on the order details stored and sent to the customer.
* Amazon MSK For Kafka: Enables the order service to publish and consume events in real-time. It supports broadcasting order events such as creation, update, or cancellation. Other microservices, such as inventory, notification, and billing, can consume these events independently and in real-time, enabling them to act promptly on order changes without direct dependencies.
* Amazon RDS (or Amazon Aurora): Stores transactional data for orders, ensuring strong consistency for order details, billing information, and historical data. This relational database can handle complex order-related queries, such as reporting on order trends or reconciling payment records.

</details>

## Service Summary

<details>

<summary></summary>

The e-commerce application's core is a highly available and scalable infrastructure, leveraging key AWS services to handle dynamic workloads and ensure seamless user experiences. The architecture is structured around the principles of the AWS Well-Architected Framework, emphasizing operational excellence, security, reliability, performance efficiency, and cost optimization​.

***

| Category                        | Service/Component               | Description                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Compute and Scaling             | Amazon ECS                      | Runs containerized microservices like product catalog and search services with orchestration and scaling. Enables consistent deployments and auto-scaling for spikes during sales.                                                                                                                                                                      |
|                                 | AWS Lambda                      | Handles essential services such as shopping cart updates, user review processing, wishlist management, and lightweight tasks like sending order confirmation emails and generating personalized recommendations. All this is done with serverless execution, automatic retries, and low latency for enhanced resilience and responsiveness.             |
|                                 | Amazon EC2                      | Supports components such as batch processing for order reconciliation, inventory synchronization, ETL workflows, and compute-intensive tasks like personalized recommendation generation and fraud detection. Auto-scaling for elasticity and detailed monitoring for optimized capacity ensure reliable performance even during high-demand scenarios. |
|                                 | Auto Scaling Groups             | Ensures availability for critical EC2-based applications by dynamically adjusting capacity to meet workload demands and maintaining optimal performance. Monitors instance health and automatically replaces unhealthy instances to provide reliable, uninterrupted operations.                                                                         |
|                                 | AWS Elastic Beanstalk           | Simplifies the deployment and management of e-commerce storefront applications, allowing developers to focus on features instead of infrastructure. Provides health monitoring and automated updates to ensure seamless operation and optimal performance.                                                                                              |
| Networking and Content Delivery | Amazon VPC                      | Creates isolated networks for sensitive data and workflows. Subnets across Availability Zones ensure resilience, while security groups control traffic.                                                                                                                                                                                                 |
|                                 | Application Load Balancer (ALB) | Balances incoming traffic between ECS tasks for consistent performance. Provides listener rules for routing traffic and logging for monitoring access patterns.                                                                                                                                                                                         |
|                                 | Amazon API Gateway              | Serves APIs for the front end and implements caching for latency reduction and throttling for API protection.                                                                                                                                                                                                                                           |
|                                 | Amazon CloudFront               | Accelerates global delivery of static assets like images, CSS, and JavaScript. Origin failover improves reliability, and field-level encryption secures delivery.                                                                                                                                                                                       |
|                                 | Amazon Route 53                 | Manages DNS routing for domains like `store.cloudexploration.com` and ensures reliable traffic direction using health checks for failover. Supports alias records to route traffic directly to AWS resources such as CloudFront distributions, S3 buckets, or Application Load Balancers for seamless integration.                                      |
| Data Management                 | Amazon RDS                      | Stores transactional data, such as customer orders and inventory levels. Multi-AZ configurations ensure availability, while Read Replicas optimize performance.                                                                                                                                                                                         |
|                                 | Amazon Aurora                   | Provides scalable relational databases for analytics and real-time inventory management. Aurora Global Databases enable low-latency multi-region access.                                                                                                                                                                                                |
|                                 | Amazon DynamoDB                 | Powers dynamic catalog data and session storage with low-latency access. On-demand backups provide disaster recovery, and global tables support multi-region applications.                                                                                                                                                                              |
|                                 | Amazon ElastiCache              | Caches frequently accessed data like product details and user sessions for faster responses. Offers Multi-AZ configurations for availability and memory monitoring for optimization.                                                                                                                                                                    |
| Messaging and Event Streaming   | Amazon MSK                      | Handles real-time event streaming for applications like inventory updates, order processing, and user activity tracking. Fully managed Kafka clusters provide scalability and integration with other AWS services.                                                                                                                                      |
|                                 | Amazon SNS                      | Facilitates real-time notifications for events such as order updates, shipment tracking, and promotional alerts. It also supports high-throughput, fan-out message delivery to multiple subscribers.                                                                                                                                                    |
|                                 | Amazon SQS                      | Manages decoupled communication between services, such as processing order workflows or queueing email notifications. Provides dead-letter queues for error handling and scales automatically for high message volumes.                                                                                                                                 |
| Storage and Backup              | Amazon S3                       | Stores media assets, product images, and backups with cost-optimization features. Lifecycle policies manage costs, and versioning ensures data recovery.                                                                                                                                                                                                |
|                                 | AWS Backup                      | Centralized management for backups of critical data like order history and profiles. Offers automated scheduling and encryption for enhanced durability and security.                                                                                                                                                                                   |
| Security and Compliance         | AWS IAM                         | Defines granular access policies for developers, CI/CD pipelines, and application components. Enforces the least privilege.                                                                                                                                                                                                                             |
|                                 | Amazon GuardDuty                | Detects anomalies like unauthorized API calls or unusual traffic patterns. Integrates findings into Security Hub for centralized monitoring and automated responses.                                                                                                                                                                                    |
|                                 | AWS WAF                         | Protects the web application from vulnerabilities like SQL injection. Custom rules block malicious IPs, and detailed logging is provided for analysis.                                                                                                                                                                                                  |
| Monitoring and Optimization     | Amazon CloudWatch               | Monitors metrics such as API latency and ECS task health. Provides real-time alarms and anomaly detection for proactive alerts.                                                                                                                                                                                                                         |
|                                 | AWS X-Ray                       | Provides distributed tracing for debugging interactions between services like cart operations. Identifies bottlenecks and optimizes latency.                                                                                                                                                                                                            |
| Deployment and Automation       | AWS CodePipeline                | Automates the deployment process for storefronts, APIs, and backend services. Multi-stage testing ensures code quality before production deployment.                                                                                                                                                                                                    |
|                                 | AWS CloudFormation              | Enables infrastructure-as-code for reproducible environment setups. Nested stacks provide modular templates for easier maintenance.                                                                                                                                                                                                                     |

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://awsinpractice.itassist.com/study-group/aws-certified-solutions-architect-associate/domain-1-design-secure-architectures/securecart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
