Front-End Web & Mobile
Build a Scalable Search Solution with AWS Amplify and OpenSearch Serverless
Introduction
In today’s data-driven digital ecosystem, building scalable search solutions has become essential for organizations managing large, complex datasets across industries. Whether it’s a streaming platform, an e-commerce marketplace, or a research database, the ability to efficiently search through structured and unstructured data is key to delivering a seamless user experience. Traditional search solutions often involve complex data transformation processes and managing dedicated search clusters, which can increase operational costs and complexity.
By leveraging AWS Amplify, Amazon OpenSearch, and Amazon DynamoDB with Zero ETL, you can build scalable, cost-effective, and serverless search solutions. This approach simplifies infrastructure management, reduces costs, and ensures a seamless user experience even under fluctuating traffic.
In this post, we’ll demonstrate how to create a movie search solution using AWS Amplify and Amazon OpenSearch. This solution will provide search capabilities, allowing users to quickly find relevant movie information. We’ll use AWS Amplify’s streamlined development experience and Amazon OpenSearch’s to build this solution.

Figure 1: Movie Search Solution
Prerequisites
- AWS account: Required to access and deploy AWS services. Note that Amplify is part of the AWS Free Tier.
- Node.js v18.17+ and npm v9+.
- Git v2.14.1+: For version control and repository management.
- Text Editor (VSCode recommended): Provides an integrated development environment.
High Level Architecture
Our serverless search solution combines several AWS services:
- AWS Amplify: Provides a modern development framework for building cloud-based applications.
- Amazon OpenSearch: Service: Powers the search functionality with advanced search capabilities.
- Amazon DynamoDB: Acts as the primary data store for the application.
- Amazon DynamoDB Zero ETL: Streamlines the data ingestion process from DynamoDB to OpenSearch Service.
- Amazon S3: The S3 bucket will be used for the initial export, which OpenSearch Ingestion will retrieve data from at the beginning.
High-level architecture diagram showing the integration of AWS Amplify, Amazon DynamoDB, Amazon OpenSearch Serverless, and Amazon S3 in a serverless search solution. The diagram illustrates data flow between services, highlighting how DynamoDB Zero ETL synchronizes data with OpenSearch through an S3 staging area.

Figure 2: Architecture Diagram of the Movie Search Solution
How It Works:
Use the AWS Amplify-powered frontend to submit search queries, which Amazon OpenSearch processes against pre-indexed data. Amazon DynamoDB serves as the primary data store, capturing and updating application data in real time. The Zero ETL feature automatically synchronizes this data with OpenSearch, enabling instant indexing of your latest information.
Amazon S3 serves as an initial staging area during the first data transfer between Dynamo db and OpenSearch. This architecture ensures a responsive, low-latency search experience, providing users with accurate and relevant results while maintaining high scalability and performance.
Implementation Steps
Step 1: Repository Setup
- Navigate to the amplify-opensearch-serverless-integration repository on AWS Samples and fork it to your GitHub repositories.
- Clone the app by running the command below in your terminal
- Access the newly cloned repository in VSCode by executing the commands below in your terminal.
VSCode will open the repository folder, including the Amplify folder, which contains the backend details that we’ll discuss in the next section.
- Project Structure Overview: The structure includes folders like amplify, backend, data, and storage, with key configuration files like
backend.ts,
resource.ts
, andsearchMovieResolver.js
visible.Figure 3: Project Structure Overview in Visual Studio Code
- Project Structure Overview: The structure includes folders like amplify, backend, data, and storage, with key configuration files like
- Run the following command at the project root in the terminal to install the necessary packages, including the Amplify packages.
npm install
Step 2: Amplify Backend Configuration
In the final application, users can search for movies by entering a title
and clicking the search button to retrieve results from Amazon OpenSearch. The code for this functionality is included in the repository you cloned. In this section, we’ll walk through the key steps to integrate your Amplify app with Amazon OpenSearch.
2.1 Define Data Model
Firstly, go to the amplify/data/resource.ts
file and add the Movie model to your schema.
Important considerations:
To ensure smooth data integration between Amazon DynamoDB and Amazon OpenSearch, you’ll need to configure two critical features:
- Point-in-Time Recovery (PITR) PITR allows you to:
- Restore your table to any point in the last 35 days.
- Capture continuous backups of your data.
- Enable reliable data recovery and synchronization.
- DynamoDB Streams DynamoDB Streams provide:
- Real-time tracking of data modifications.
- Capture of all item-level changes.
- Essential support for streaming data to OpenSearch.
Navigate to your amplify/backend.ts
file and add the following configuration:
Step 3: OpenSearch Serverless collection Setup
In your code go to amplify/backend.ts
file, create an Amazon OpenSearch serverless collection.
3.1 Add OpenSearch as HttpDatasource to backend
To add the OpenSearch data source, add this code to amplify/backend.ts
.
Step 4: Zero ETL Integration
4.1 Storage Configuration
Establish Storage to back up raw events consumed by the Amazon OpenSearch pipeline. Generate a file named amplify/storage/resource.ts
and insert the provided content to set up a storage resource. Tailor your storage configurations to regulate access to different paths within your storage bucket.
In your amplify/backend.ts
file, get the s3BucketArn
value from storage resource as shown below. Additionally, configure an IAM role for the pipeline and assign the roles as indicated below. For further information on the required IAM roles, please refer to the Setting up roles and users documentation.
For the Amazon S3 bucket, adhere to standard security practices: block public access, encrypt data at rest, and enable versioning. Note that versioning is enabled by default in Amplify.
4.2 IAM Role Configuration
Understanding IAM Role Setup
In this section, you’ll configure the security permissions that allow your OpenSearch Ingestion Service (OSIS) to securely access and transfer data between different AWS services. Navigate to your amplify/backend.ts
file and add the following configuration:
Key Security Objectives:
- Grant precise access to OpenSearch.
- Secure DynamoDB and S3 data transfers.
- Follow the principle of least privilege.
4.2.1 DynamoDB Policies
4.2.1.1 Export Job Policy
Grants permissions to describe tables, check backups, and initiate exports.
4.2.1.2 Export Job Monitoring Policy
Allows tracking of export job status using wildcard permissions for dynamic export IDs.
4.2.1.3 Stream Access Policy
Provides real-time synchronization by granting permissions to read stream data and manage iterators.
4.2.2 S3 Policy for Export Operations
Grants permissions for reading and writing data to an S3 bucket during DynamoDB exports.
4.2.3 OpenSearch Policies
4.2.3.1 OpenSearch Collection Policy
Enables indexing, querying, and managing OpenSearch collections.
4.2.3.2 Encryption Policy
Defines encryption settings for OpenSearch Serverless collections.
4.2.3.3. Network Policy
Controls network access to the OpenSearch collection.
4.2.3.4 Data Access Policy
Grants permissions for creating, updating, and querying data in OpenSearch collections and indexes.
4.3 Create OpenSearch Service Pipeline
When using OpenSearch, defining an index template or mapping in advance provides powerful capabilities for precise data ingestion and search. This approach you can:
- Set specific data types for each document field
- Optimize search performance
- Ensure consistent data structure.
The configuration is a data-prepper feature of OpenSearch. For specific documentation on DynamoDB configuration, refer to OpenSearch data-prepper documentation.
Pipeline Configuration Breakdown
Source Configuration
- Specifies DynamoDB as the data source
- Defines target table for ingestion
- Sets stream starting point
- Configures S3 backup bucket
- Assigns IAM role for pipeline permissions
Sink Configuration
- Specifies OpenSearch domain cluster
- Sets index name and type
- Defines index mapping template
- Configures document metadata handling
- Sets bulk request size
- Assigns IAM role for sink operations
Advanced Configuration Options
- Sink configuration supports multiple indexes
- Multiple tables can be configured through separate pipelines
For further guidance, please consult the pipeline section of the OpenSearch documentation.
Now, create the OSIS pipeline resource:
After deploying your resources, you’ll want to confirm that your data pipeline is set up correctly before adding items to your Movie
table. Here’s how to verify your pipeline configuration:
- Open the AWS Management Console Navigate to the Amazon OpenSearch Service section.
- Check the Pipelines Section Look for the pipeline you just created. Specifically, you’ll want to:
- Confirm the pipeline name matches your configuration.
- Verify the source and destination settings.
- Check the current status of the pipeline.
The image shows a configured pipeline with details including pipeline name, status, source, and destination settings.

Figure 4: Ingestion Pipeline configuration
Step 5: OpenSearch Query Implementation
Create Resolver and attach to query
Let’s create the search resolver. Create a new file named amplify/data/searchMovieResolver.js
and paste the following code. For additional details please refer to Amazon OpenSearch Service Resolvers.
Navigate to the amplify/data/resource.ts
file and modify the schema to include the search query:
Step 6: Deployment and Verification
1. Open your terminal and run the following command to start your personal cloud sandbox:
2. Open a separate terminal and run the following command to start a local development server.
The Movie Search Solution interface displays movie search results, presenting a list of titles and descriptions retrieved from OpenSearch.

Figure 5: Interfacing with the Movie Search Solution
Clean up
Now that you’ve completed this walkthrough, be sure to delete the backend resources to avoid any unexpected costs. You can remove the app as outlined below and verify that all resources are terminated in the AWS Console.
Conclusion
Congratulations! You’ve successfully created a scalable, serverless movie collection search solution using AWS Amplify and Amazon OpenSearch Serverless. You’ve also validated the search results through an Amplify-powered frontend. This approach delivers efficient, cost-effective search capabilities with minimal infrastructure management. Explore further about Amplify by trying our Quickstart tutorial, and join our Community Discord to provide feedback or feature requests.