Unleashing the Power of Amazon OpenSearch with Serverless Computing

Ram Ambadas Dandale
Ankercloud Engineering
5 min readMar 18, 2023

MAXIMIZING EFFICIENCY AND FLEXIBILITY WITH AMAZON OPENSEARCH SERVERLESS — A COMPLETE GUIDE FOR DEVELOPERS

Introduction

Amazon OpenSearch is a powerful tool for search and analytics, but deploying and managing it can be challenging. Serverless computing provides a solution that allows you to deploy and run OpenSearch on a cloud platform without managing infrastructure. In this blog post, we’ll understand Amazon OpenSearch Serverless and how to get started with this technology.

Amazon OpenSearch Serverless

In today’s data-driven world, organizations need to extract valuable insights from petabytes of data quickly and efficiently. Amazon OpenSearch is an open-source search and analytics engine that is fully compatible with Elasticsearch APIs. It allows you to search, analyze, and visualize petabytes of data in real-time. Additionally, with Amazon OpenSearch, you can build sophisticated search and analytics applications that meet your specific business needs.

But deploying and managing OpenSearch can be challenging, especially if you want to ensure high availability, scalability, and cost-effectiveness. This is where Serverless computing comes into play. Serverless computing is a cloud computing model in which the cloud provider manages the infrastructure and automatically provisions, scales, and manages servers as needed.

Serverless computing is ideal for running OpenSearch queries and aggregations because it can handle sudden bursts of traffic, auto-scale to meet demand, and reduce costs by only charging for the actual usage. When you run OpenSearch on a Serverless platform, you don’t need to worry about provisioning or managing servers. Instead, you only need to pay for the number of requests that your application generates.

How to get started with Amazon OpenSearch Serverless?

Getting started with Amazon OpenSearch Serverless involves several steps. Here’s an overview of the process:

Amazon OpenSearch Console

1. Configure permissions

To use OpenSearch Serverless in general, you must have the correct IAM permissions. OpenSearch Serverless uses the following AWS Identity and Access Management (IAM) permissions for creating and managing collections.

  • aoss :CreateCollection — Create a collection.
  • aoss:ListCollections — List collections in the current account.
  • aoss:BatchGetCollection — Get details about one or more collections.
  • aoss:UpdateCollection — Modify a collection.
  • aoss:DeleteCollection — Delete a collection.

2. Create a collection

A collection in OpenSearch Serverless is a logical grouping of one or more indexes that represent a workload. OpenSearch Serverless supports two primary collection types: Time-Series and Search.

Creating Amazon OpenSearch Serverless Collection
  • Choose Collections in the left navigation pane and choose Create collection.
  • Name the collection search-movies-demo. Choose “Search” as the collection type.
  • Under Encryption, select “Use AWS owned key”.
  • Under Network, configure the access type as “Public”.
  • Enable access to both OpenSearch endpoints and OpenSearch Dashboard for resource type.
  • After reviewing your collection settings, select the Submit button and wait for several minutes for the collection status to change to “Active”.

3. Upload and search data

Amazon OpenSearch sign in by AWS access key and secret key
  • Choose the OpenSearch Dashboards URL provided for your collection.
  • Sign in using the AWS access and secret keys associated with the user in data access policy.
  • From within OpenSearch Dashboards, select Dev Tools.
Amazon OpenSearch Dashboard
  • To create a new index called “movies-index”, send the following request:
Code written in Dev Tools for creating Index i.e. “movies-index
  • After the index is created, you can ingest documents into the index. OpenSearch provides the option to ingest multiple documents in one request using the _bulk request. Enter POST /_bulk in the left pane of OpenSearch Dashboard.
Ingesting multiple documents in one request through “POST /_bulk”

4. Delete the collection

  • Return to the Amazon OpenSearch Service console.
  • Choose the “Delete” button and confirm the deletion to remove the collection from your environment.

Amazon OpenSearch Serverless compute capacity for data ingestion, searching, and querying are measured in OpenSearch Compute Units (OCUs). Each OCU is a combination of 6 GiB of memory and corresponding virtual CPU (vCPU), as well as data transfer to Amazon S3. Each OCU includes enough hot ephemeral storage for 120 GiB of index data. When you create your first collection, OpenSearch Serverless instantiates two OCUs — one for indexing and one for search.

Amazon OpenSearch Serverless Supported Regions

As of March 2023, Amazon OpenSearch Serverless is available in the following regions:

1. US East (N. Virginia)

2. US East (Ohio)

3. US West (Oregon)

4. Europe (Ireland)

5. Europe (Frankfurt)

6. Asia Pacific (Singapore)

7. Asia Pacific (Sydney)

8. Asia Pacific (Tokyo)

Amazon OpenSearch Serverless Pricing

In OpenSearch Serverless, you’re charged for the following components:

● Data ingestion compute

● Search and query compute

● Storage retained in Amazon S3

OCUs are billed on an hourly basis, with per-second granularity. You’re also billed on a monthly basis for data stored in Amazon S3. You aren’t charged for using OpenSearch Dashboards. You’re billed for a minimum of 4 OCUs for the first collection in your account (2 x ingest includes primary and standby, and 2 x search includes one active replica for high availability). Here’s a table of the pricing for Amazon OpenSearch Serverless across all supported regions as of March 2023:

Amazon OpenSearch Serverless Pricing

Note that these prices are subject to change, so be sure to check the AWS documentation for the latest pricing information. Additionally, pricing for additional services, such as CloudWatch and VPC, may apply depending on your use case.

Conclusion

Amazon OpenSearch Serverless is a powerful combination that allows you to build sophisticated search and analytics applications without the need to manage infrastructure. With Serverless computing, you can focus on building your OpenSearch applications while the cloud provider handles everything else.

Amazon OpenSearch Serverless can help reduce infrastructure costs, improve scalability, and provide a low-maintenance solution for deploying and managing OpenSearch applications. So, if you’re looking for a scalable, cost-effective, and flexible way to run OpenSearch, consider using Amazon OpenSearch Serverless.

--

--