Create OpenSearch Index
You will need to create a sample index in OpenSearch so you can store and query data for an alert. To do this, you will run a Python application in our Cloud9 environment to create the index.
Step 1 - Create Index
- Navigate to the Cloud9 Console
- Click on Open IDE under the already created workshop-cloud9 environment.

The OpenSearch_API_Examples repository will be automatically pulled down to your environment. Do the following within the Cloud9 console.
- Open the file OpenSearch_API_Examples/Alerting/1_create_index.py
- Update the os_url variable to your OpenSearch instance. This is the value of the OSDomainURL key from the CloudFormation stack output.
- Go to File -> Save to save the changes to 1_create_index.py
In the terminal window, run the following commands:
pip install requests
python OpenSearch_API_Examples/Alerting/1_create_index.py
Step 2 - Check that the Index was Created via. OpenSearch Dashboard
The image below highlights the commands.

This command creates and index for use in this workshop
- Open the OpenSearch Dashboard using the URL provided in the value for the key DashboardURL in the CloudFormation outputs

Once you open the dashboard URL you will be prompted to login
- Enter
OSMasterUser
as the username
- Enter
AwS#OpenSearch1
as the password
- Click on Log In
- If an additional pop up window is present after login asking about data upload click on Explore on my own
- If an additional pop up windows is present asking you to select your tenant select Global and click on Confirm
Once you have logged in to the OpenSearch dashboard
- Click on the top left hand menu on the OpenSearch dashboard
- Click on Index Management under the OpenSearch Plugins section

- Click on Indices
You should be able to see an index alert-1 is present

When you are ready move on to the next step Create Alert