# Guidance for Managing Planograms with Amazon Bedrock

## Overview

This Guidance demonstrates how to streamline retail planogram creation and compliance using Amazon Bedrock. It shows how to leverage generative AI to efficiently consider multiple factors such as sales data, product velocity, item dimensions, brand colors, and shelf capacity to generate initial planograms. Retailers can automatically generate optimal product layouts and verify shelf compliance through photo analysis, allowing marketing teams to make location-specific adjustments as needed. AI-assisted planogram creation can help retailers optimize processes, increase efficiency, and reallocate resources for more strategic tasks.

## How it works

These technical details feature an architecture diagram to illustrate how to effectively use this solution. The architecture diagram shows the key components and their interactions, providing an overview of the architecture's structure and functionality step-by-step.

[Download the architecture diagram](https://d1.awsstatic.com/solutions/guidance/architecture-diagrams/managing-planograms-with-amazon-bedrock.pdf)

![Architecture diagram](/images/solutions/managing-planograms-with-amazon-bedrock/images/managing-planograms-with-amazon-bedrock-1.png)

1. **Step 1**: The user enters a prompt for the planogram to be generated using the application UI. The prompt includes the planogram dimensions and placement instructions. The user can also specify additional rules to be applied for the planogram.
1. **Step 2**: An Application Load Balancer (ALB) in the virtual private cloud (VPC) public subnet takes in the user request and distributes the workload evenly to the application deployed on AWS. The security group configuration in Amazon Elastic Container Service (Amazon ECS) helps ensure that only inbound traffic from allowed sources is processed.
1. **Step 3**: The planogram application takes in requests and processes them in containers, storing container images in Amazon Elastic Container Registry (Amazon ECR). The tasks run using Amazon ECS, and AWS Fargate acts as the compute engine for Amazon ECS tasks, providing a serverless way to run containers without managing servers or clusters.
1. **Step 4**: Amazon Simple Storage Service (Amazon S3) stores the planogram images generated by the application and other static web assets. The planogram instructions, the underlying supported models, the rules, the templates, and the product metadata persist in Amazon DynamoDB tables.
1. **Step 5**: Amazon Bedrock receives the request to generate the planogram over an API call and invokes the model the user specified in the application UI. The provided prompt is enhanced by the placement rules stored in DynamoDB. Amazon S3 stores the generated planogram for the application UI to display.
1. **Step 6**: For validation, the user provides a planogram and a captured image of the shelf. Amazon SageMaker AI processes this validation request through API calls using the planogram validation model inference.
1. **Step 7**: The application returns the generated planogram and the results of the validation to you using the NAT gateway, where the application UI renders corresponding images pulled from Amazon S3.
## Deploy with confidence

Everything you need to launch this Guidance in your account is right here.

- **Let's make it happen**: Ready to deploy? Review the sample code on GitHub for detailed deployment instructions to deploy as-is or customize to fit your needs.

[Go to sample code](https://github.com/aws-solutions-library-samples/guidance-for-managing-planograms-with-amazon-bedrock)


## Well-Architected Pillars

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

### Operational Excellence

With real-time performance tracking and alerting,Amazon CloudWatch provides comprehensive, proactive monitoring and observability for the Amazon ECS clusters and load balancers. This enables automated operations that help you quickly identify and diagnose issues, reducing the operational burden on your team. [Read the Operational Excellence whitepaper](/wellarchitected/latest/operational-excellence-pillar/welcome.html)


### Security

AWS Identity and Access Management (IAM) provides fine-grained access control for AWS resources, including managing permissions for users, roles, and services. This creates a robust security posture through the principle of least privilege. By only granting the necessary permissions to users and services, you reduce the risk of unauthorized access and better protect against data breaches. [Read the Security whitepaper](/wellarchitected/latest/security-pillar/welcome.html)


### Reliability

By automatically restarting failed containers and scaling based on demand, Amazon ECS helps maintain consistent availability of the planogram generation service. DynamoDB provides a highly available and durable database for storing planogram data and metadata. Its built-in replication across multiple Availability Zones means that planogram data remains accessible even if one zone experiences an outage. ALB distributes incoming traffic across multiple Amazon ECS tasks so that the application remains responsive, even during high load periods. Health checks and automatic routing to healthy instances help prevent downtime if an individual container or task fails. [Read the Reliability whitepaper](/wellarchitected/latest/reliability-pillar/welcome.html)


### Performance Efficiency

Amazon ECS automatically scales the number of container instances based on demand, facilitating efficient deployment of the planogram generation service. Amazon Bedrock provides high-performance, scalable AI models without the need for you to manage infrastructure. Its managed AI capabilities enable rapid planogram creation, significantly reducing time to result. [Read the Performance Efficiency whitepaper](/wellarchitected/latest/performance-efficiency-pillar/welcome.html)


### Cost Optimization

Amazon S3 offers tiered storage classes based on data access patterns, enabling cost-effective storage of planogram images and related data. For example, it can automatically move older planograms to less expensive storage tiers. Amazon Bedrock is serverless, so you only pay for the actual AI processing used in generating planograms. This removes costly upfront infrastructure investments and reduces spending on idle ML resources.. DynamoDB offers an on-demand capacity mode, enabling the database to automatically scale up or down based on actual usage. This means that you’ll only pay for the actual read and write operations performed. [Read the Cost Optimization whitepaper](/wellarchitected/latest/cost-optimization-pillar/welcome.html)


### Sustainability

Amazon ECS consolidates multiple workloads onto shared instances. This is more sustainable than running separate instances for each component, reducing the overall energy consumption and carbon footprint of the planogram generation system. Amazon Bedrock provides serverless AI capabilities, removing the need for dedicated, always-on ML infrastructure. It only consumes AI resources when actively generating planograms, avoiding energy waste. Amazon S3 uses energy-efficient storage systems like Amazon S3 Intelligent-Tiering, which uses lifecycle policies to automatically transition less frequently accessed data to more sustainable storage tiers. [Read the Sustainability whitepaper](/wellarchitected/latest/sustainability-pillar/sustainability-pillar.html)


[Read usage guidelines](/solutions/guidance-disclaimers/)

