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 and Opensearch 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
  1. Head over to bonsai.io and select Sign up.

    Setup Zero

  2. Provide your account details.

    Setup Zero

  3. Describe your project - it does not really matter what you pick.

    Setup Zero

  4. Name your test cluster (you can call it anything you like). You have the choice between Elasticsearch 7.10.2 and OpenSearch 1.0.0. Both will work so its your choice. I went with OpenSearch 1.0.0. And then pick the region closed to you - I picked AWS Asia Pacific.

    Setup Zero

  5. Then check your email and click the button in the email to verify yourself.

    Setup Zero

  6. 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.

    Setup Zero

  7. We now need to click on the Credentials tab. Highlighted in red in this picture

    Setup Zero

  8. Now we need to record our cluster URL and authorisation credentials. All these details can be viewed in the URL field in the Full Access section of the below page. The URL field includes:
    • The username which is between the URL scheme (https://) and the colon (:).
    • The password which is between the colon (:) and the at sign (@).
    • The cluster URL which is everything after the the at sign (@).

      Setup Zero

  9. 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 click Ok.

    Setup Zero

  10. Now that the page has loaded click Authorize, and a pop will be displayed requesting the username and password from step 8. Input these and click authorise and then click Close. The Swagger UI should now be connected and authorised to your elasticsearch/Opensearch cluster. So you can commence running through the training videos.

    Setup Zero

Elastic Cloud Setup Steps
  1. Head over to elastic.co and click Try Free, in the top right hand corner.

    Setup one

  2. Provide your email and select a password. Then click Start free trial.

    Setup two

  3. Pick a name for your cluster (e.g. test) and then select Create deployment

    Setup Zero

  4. 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.

    Setup Zero

  5. 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.

    Setup Zero

  6. The below screen will then be diplayed indicating that your email has been verified. Click the Open Elastic Cloud button.

    Setup Zero

  7. The summary cluster page will be displayed. Click the cluster name (i.e. test) to view the specific cluster details.

    Setup Zero

  8. How copy the elasticsearch endpoint URL (by clicking A in the below screenshot) and saved it for later. Then click the edit tab under deployment name in the left hand navigation pane.

    Setup Zero

  9. On this page click edit elasticsearch.yml and add in the following config values then scroll to the bottom of the page and click Save 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
    

    Setup Zero

    These changes allow requests from Swagger UI hosted on another site to send requests to the elasticsearch API. This configuration change will require a restart of the elasticsearch cluster - so it will take a few minutes to complete.
  10. 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 click Ok.

    Setup Zero

  11. Now head over to this Swagger UI page to run through the training.

    Setup Zero

  12. Input the elasticsearch cluster's URL from step 8 and click Ok. The Swagger UI page should load.

    Setup Zero

  13. Now that the page has loaded click Authorize, and a pop will be displayed requesting the username and password from step 8. Input these and click authorise and then click Close. The Swagger UI should now be connected and authorised to your elasticsearch/Opensearch cluster. So you can commence running through the training videos.

    Setup Zero