BlueXP Blog

Automating Cloud Operations with Cloud Volumes ONTAP and REST

Written by Aviv Degani, Cloud Solutions Architecture Manager, NetApp | Jan 10, 2019 2:17:29 PM

NetApp OnCommand® Cloud Manager gives users a modern and easy-to-use graphical UI that makes deploying and getting started with Cloud Volumes ONTAP very straightforward. Very often, however, there are situations where a programmatic interface is more useful, especially for developers, who thrive on cloud automation. For these users, all of Cloud Manager's operations can be carried out by code and automated. 

Consider this for example: DevOps CI/CD pipelines are unmanned process workflows that are normally triggered by a code check-in. By integrating with Cloud Volumes ONTAP, a cloud DevOps pipeline could spin up test copies of production data by automatically cloning existing storage volumes. That would speed up software testing, reduce human errors, and lead to a faster TTM.

In this article, we will take a high-level look at the functionality provided by Cloud Manager and demonstrate how the same operations can be automated using command line scripts.

Automating Cloud Management Operations

 

The Cloud Manager working environments dashboard.

Cloud Manager is central to the deployment and management of Cloud Volumes ONTAP. As well as deploying new instances, you can also discover existing on-premises or cloud-based ONTAP storage environments. This allows you to manage NetApp SnapMirror® data replication directly from the main dashboard. Creating snapshots and clones of existing storage volumes is also easily and intuitively accomplished.

There are many scenarios where cloud automation extends the utility of what can be achieved through Cloud Manager:

  • DevOps: Instead of deploying Cloud Volumes ONTAP by stepping through the wizard, users could combine the deployment of storage services and other cloud infrastructure to perform a complete system rollout in a single operation. This not only simplifies the setup of production environments, but also secondary environments, such as for development, test, and pre-production staging, and can help to speed-up automated testing processes.

  • Cloud Migration: When migrating to the cloud, it becomes important to automate as much of the setup and configuration as possible. Storage administrators need to create volumes, data replication relationships, file shares, and much more. Creating scripts and templates to do this makes deployment faster, repeatable, and more reliable. After deploying a fully-functional environment, being able to automate operations, such as cloning, expedites the process of performing site tests that verify migrated services are operating correctly.

  • Disaster Recovery: In the event that a disaster recovery (DR) site needs to be brought online, it is crucial to failover storage services as quickly and efficiently as possible. This will typically be performed in conjunction with the failover of other applications and services, and so will need to be sequenced appropriately. The best way to perform a complicated orchestration of this kind, especially when there is pressure to precisely restore business-critical services, is without direct human intervention.

Automating Cloud Manager using RESTful API

Cloud Manager supports seamless cloud automation through a REST API architecture, which enables any of the operations available in the UI to be accessible from scripts and application code. Such an API call can start a single task or a sequence of an orchestrated multiple-step process. Cloud Manager’s dashboard provides access to the API’s Swagger interface, which provides detailed documentation for all of the available API endpoints, including the parameters and payloads each endpoint expects to receive and the information returned. Users can even try out the endpoints directly from the API portal.

What is REST API?

REST (REpresentational State Transfer) APIs allow for client and server communication over the HTTP protocol. REST has become the standard way to perform client/server communication over HTTP, with wide support across nearly all programming languages and operating systems. Each REST API endpoint is accessed using an HTTP verb in combination with a path.

Cloud Manager REST API Example

For example, in order to create a new Cloud Volumes ONTAP working environment via the Cloud Manager REST APIs, we would use the POST verb with the /vsa/working-environments path and specify all the relevant details in the body of the HTTP request we send to Cloud Manager. Similarly, we can access the details of all our working environments by using the same path with the GET verb.

The following provides a list of some of the REST API methods supported by Cloud Manager, from among the many that are available:

  • POST /onprem/working-environments

    Discover an existing on-premises ONTAP storage environment.

  • POST /replication/vsa: Creates a new SnapMirror replication relationship to an instance of Cloud Volumes ONTAP.

  • GET /replication/status

    Gets the status of all replication relationships visible to the current user.

  • POST

    /replication/break/{destinationWorkingEnvironmentId}/{destinationSvmName}/{destinationVolumeName}

    Breaks a SnapMirror relationship, which is used to perform a failover.

  • POST /vsa/volumes/{workingEnvironmentId}/{svmName}/{volumeName}/snapshot:

    Creates a new snapshot for a volume.

  • POST /vsa/volumes/{workingEnvironmentId}/{svmName}/{volumeName}/clone

    Creates a zero-capacity cost data clone of an existing volume using NetApp FlexClone®.

Calling an API Endpoint Using cURL

Before you can perform any REST API calls, you must first perform a login operation. This can be done either by acquiring a token from Cloud Manager or by using a cookie. The following example demonstrates using a cookie. Further instructions for using tokens can be found here.

This will write the resulting cookie file to your home directory. The file can then be referenced in subsequent API calls in order to authenticate the user performing the operation.

The following provides an example of creating a new volume:

After completing all the work, you need to perform, you can logout of the API with the following command:

The complete guide to using the API, which contains a whole library of examples, can be found here.

Conclusion

Cloud Manager is the single-pane cloud operations manager for Cloud Volumes ONTAP. Cloud Manager REST API endpoints can make use of Cloud Volumes ONTAP in new and sophisticated ways, especially when there is a requirement to integrate with automated processes. As we have seen, secure access to the API endpoints is possible using basic and ubiquitous command line tools, such as cURL. Nearly every programming language and operating system also supports HTTP and REST, which ensures simple and uniform integration with other cloud management tools.