Elasticsearch Cloud Instance Setup
The purpose of this page is to run you through creating an elastisearch (or opensearch) cloud instance, that you can then use for the training swagger-4-es training Swagger UI page.
There are are a lot of cloud service providers to pick from including:
For a simple setup I would recommend going with Bonsai, for the following reasons:
- they are owned by IBM (they are not going away any time soon),
- they do not require a credit card to trial the service, and
- they provide
Elasticsearch
andOpensearch
options. - they have Cross-Origin Resource Sharing (CORS) setup by default.
Alternatively Elastic Cloud is also a good option that does not require a credit card. Noting that CORS has to be setup for the Swagger UI to work with Elastic Cloud. The steps to do this are provided below in the Elastic Cloud setup section. Noting that you can apply the specified CORS configuration to any other cloud provider.
Bonsai Setup Steps
- Head over to bonsai.io and select
Sign up
. - Provide your account details.
- Describe your project - it does not really matter what you pick.
- Name your test cluster (you can call it anything you like). You have the choice between
Elasticsearch 7.10.2
andOpenSearch 1.0.0
. Both will work so its your choice. I went withOpenSearch 1.0.0
. And then pick the region closed to you - I picked AWS Asia Pacific. - Then check your email and click the button in the email to verify yourself.
- It might take a minute or two, but shortly after the test cluster will be up and running. I named my cluster
test
. Click on the cluster name to see the cluster details. - We now need to click on the Credentials tab. Highlighted in red in this picture
- Now we need to record our cluster
URL
and authorisation credentials. All these details can be viewed in theURL
field in theFull Access
section of the below page. The URL field includes: - Now head over to this Swagger UI page. When the page loads it will prompt you to provide the URL for your cluster. Input the
URL
you found in the previous step and clickOk
. - Now that the page has loaded click
Authorize
, and a pop will be displayed requesting theusername
andpassword
from step 8. Input these and clickauthorise
and then clickClose
. The Swagger UI should now be connected and authorised to your elasticsearch/Opensearch cluster. So you can commence running through the training videos.
Elastic Cloud Setup Steps
- Head over to elastic.co and click
Try Free
, in the top right hand corner. - Provide your email and select a password. Then click
Start free trial
. - Pick a name for your cluster (e.g. test) and then select
Create deployment
- The below screen will be displayed that will provide you with your username and password. Download and/or save these details somewhere as you will need them later. You will also notice some messages at the top of the screen indicating that your cluster is being built.
- Now head over to your email and you will have an email requesting you to
Verify and Accept
your identify and accept the provided terms and conditions. Click the buttom in the email. - The below screen will then be diplayed indicating that your email has been verified. Click the
Open Elastic Cloud
button. - The summary cluster page will be displayed. Click the cluster name (i.e.
test
) to view the specific cluster details. - How copy the elasticsearch endpoint URL (by clicking
A
in the below screenshot) and saved it for later. Then click theedit
tab under deployment name in the left hand navigation pane. - On this page click
edit elasticsearch.yml
and add in the following config values then scroll to the bottom of the page and clickSave
and then confirm.
http.cors.enabled: true http.cors.allow-credentials: true http.cors.allow-origin: "*" http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization, Access-Control-Allow-Headers, Accept
- Now head over to the Swagger UI page for the lesson you want to run through. When the page loads it will prompt you to provide the URL for your cluster. Input the
URL
you found in the previous step and clickOk
. - Now head over to this Swagger UI page to run through the training.
- Input the elasticsearch cluster's URL from step 8 and click
Ok
. The Swagger UI page should load.
- Now that the page has loaded click
Authorize
, and a pop will be displayed requesting theusername
andpassword
from step 8. Input these and clickauthorise
and then clickClose
. The Swagger UI should now be connected and authorised to your elasticsearch/Opensearch cluster. So you can commence running through the training videos.