title: Version control Kibana Saved Objects?
body: <p>How can I automate version control of Kibana Saved Objects in an AWS environment?</p>
  
  <p>I have an Elasticsearch domain hosted on AWS and I have configured Kibana to visualize the data. Now, I would like to version control the Kibana configuration for several reasons:</p>
  
  <ul>
  <li>To have a consistent configuration across different environments (dev, stage, prod)</li>
  <li>Disaster recovery in case the Elasticsearch domain is deleted</li>
  <li>To be able to upgrade the Elasticsearch cluster to the latest version (I cannot use the <a href="https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-version-migration.html" rel="noreferrer">AWS console to upgrade Elasticsearch</a> as suggested in the AWS developer guide, since the Elasticsearch domain is part of a CloudFormation stack. Moreover, according to the CloudFormation user Guide, updating the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-elasticsearchversion" rel="noreferrer">ElasticsearchVersion</a> requires <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement" rel="noreferrer">replacement</a>, hence the need for version control).</li>
  </ul>
  
  <hr>
  
  <p>The only solution that I have found so far includes several manual steps:</p>
  
  <p>Backup:</p>
  
  <ol>
  <li>Logon to your first Kibana environment</li>
  <li>Select the <code>Saved Objects</code> tab in the Kibana management console</li>
  <li>Press the <code>Export Everything</code> button</li>
  <li>Add the downloaded .json file to version control</li>
  </ol>
  
  <p>Restore:</p>
  
  <ol>
  <li>Logon to the second Kibana environment</li>
  <li>Select <code>Index Patterns</code> tab in the Kibana management console</li>
  <li>Re-create the index patterns that are required for the visualizations (see <a href="https://www.elastic.co/guide/en/kibana/6.2/managing-saved-objects.html" rel="noreferrer">the last warning</a> in the Kibana user guide)</li>
  <li>Select the <code>Saved Objects</code> tab in the Kibana management console</li>
  <li>Press the <code>Import</code> button and upload the .json file that was version controlled</li>
  <li>Re-map each index pattern (since the ones stored in the .json file originates from the first Kibana environment does not exist in the second environment)</li>
  <li>Done(?)</li>
  </ol>
  
  <p>How can this be automated?</p>
  
  <p>Current environment:</p>
  
  <ul>
  <li>Elasticsearch version 6.2.3</li>
  <li>Kibana version 6.2.3</li>
  </ul>