Repeatable infrastructure

更新时间:
复制 MD 格式

Build repeatable cloud infrastructure by integrating services through OpenAPI and native tools, or by using resource-based approaches such as Cloud Control API and Terraform.

In the cloud, there are two main ways to integrate cloud services and achieve repeatable infrastructure.

Integrate cloud services with OpenAPI and native tools

Cloud computing customers typically access cloud resources in two ways: through the console's visual interface or through OpenAPI and its native tools. The console suits customers who need straightforward cloud adoption and resource management, while OpenAPI is better suited for developers who require automated management and complex business integration.

The console provides a graphical interface that lets users manage cloud resources without writing code. For example, operations and maintenance (O&M) engineers use the console to create, configure, and monitor resources such as Elastic Compute Service instances, databases, and storage. They also view and handle system alerts and logs. Business personnel can use the console to access applications and view business data.

However, an API must be readable by both humans and machines, and is ultimately executed by machines. Although an API is abstract, it requires a concrete form to be integrated and used efficiently by humans.

image.png

To effectively evaluate, use, and maintain APIs, OpenAPI users should consider the OpenAPI specification, API quality and stability, usage efficiency, performance, versioning, security and reliability, and error messages and log records.

Explore and evaluate OpenAPI

  1. Explore OpenAPI to match business needs: A cloud service provider should offer atomic OpenAPI capabilities that are fully equivalent to the console's features. Each OpenAPI must have detailed documentation, including a feature description, business parameters, and error codes. Developers can select the appropriate OpenAPI using the API exploration tools provided by the platform or by consulting the documentation.

  1. Evaluate your business scenarios and capabilities: Which parts of the business should be automated? What is the cost of development resources? Does the business technology architecture meet the required standards? Developers must weigh these trade-offs for their specific business scenarios. Using OpenAPI, they can find the optimal balance between cloud business automation, efficiency, investment cost, and output.

Debug and integrate OpenAPI

  1. Debug OpenAPI: You can test OpenAPI requests to verify that they meet business needs. This process ensures that the API features work as expected, the responses are stable, and the design is standardized. It also prepares for deeper integration and a stable production launch. During the OpenAPI debugging process, you typically need to understand parameter structures, parameter combinations, Endpoint specifications, and how to diagnose the causes of errors. Using the official API debugging tools provided by the cloud vendor can maximize the out-of-the-box experience.

  1. Choose the right native development tools: Cloud vendors provide many first-party tools for developers at different stages, with different scenarios and capabilities. Choosing the right development tool can greatly improve OpenAPI usage efficiency. For example, a software development kit (SDK) reduces the effort required for developers to write complex code for API calls, without having to understand the underlying implementation details. A command-line interface (CLI) is used to manage and operate cloud resources. Terraform is used to manage complex infrastructure environments across multiple cloud service providers, regions, and accounts.

  1. Follow the OpenAPI provider's requirements: Based on server-side limits such as throttling quotas, you should reasonably manage the number of API calls. This helps avoid extra fees or service interruptions caused by excessive calls. Alternatively, based on service traffic estimates, you can plan for quota increases, throttling, and disaster recovery in advance.

O&M and administration of OpenAPI

  1. Follow API changes and version upgrades: Stay informed about API changes and new releases to make timely business responses. When necessary, you should quickly adjust your code to improve service availability and reduce the negative impact of breaking changes on business stability.

  1. Track call logs and error messages:

    • All OpenAPI requests can be audited. The API gateway records, stores, and queries request and response information, including parameters, request time, status codes, and response times. You can use this data to monitor API performance and security.

    • API call records help developers understand usage patterns and identify optimization opportunities. Audit data also supports compliance management, security monitoring, and emergency response investigations.

Integrate cloud services using a resource-based approach

Integrating cloud services with OpenAPI often presents the following challenges:

  • Large number of APIs: As Alibaba Cloud services expand, the number of APIs grows. Developers must invest more time learning each API's usage and features, and more testing to ensure integration accuracy and stability.

  • Complex integration: As services grow, developers must handle multi-API integration, data format and protocol conversion, and exception handling, all of which increase development effort.

  • Difficult maintenance: As APIs and integration complexity grow, developers must track service changes and promptly update integrated systems to maintain stability and availability.

In the cloud, you can use a resource-based approach to integrate cloud services and reduce integration costs. There are two main ways to do this:

Cloud Control API

Cloud Control API provides a one-stop, resource-oriented solution for enterprise-level integration with Alibaba Cloud, helping enterprises and ecosystem partners improve integration efficiency and reduce maintenance costs. With a standardized API set, advanced developers can avoid learning the business-specific differences between individual cloud service APIs and maintain continuous integration during O&M.

Cloud Control API is a free OpenAPI developer tool suite that provides a consistent set of operations (CreateResource, UpdateResource, ListResources, DeleteResource) and a single SDK to manage and integrate hundreds of Alibaba Cloud products. When new products or features are added, you can integrate them with near-zero learning and development costs.

Terraform

Terraform is a popular infrastructure as code tool for writing reusable code modules and simplifying repetitive work. It supports multicloud deployment across multiple providers, and its configuration language is highly readable and easy to maintain. Terraform also supports simulated environments for testing infrastructure code in local or CI/CD environments, and its active community offers many third-party modules and plugins.

image.png

However, these approaches come with limitations such as complex configuration, a steep learning curve, and slower large-scale deployments. Adopting them within an organization may also encounter resistance. Based on extensive customer experience, we recommend starting with the following aspects:

Shift your mindset

Team members accustomed to manual infrastructure management often prefer making changes directly, such as connecting to a server over SSH and running commands. Migrating to infrastructure as code requires a shift: changes are now made by editing and committing code, with an automated process handling deployment. This indirect approach may face initial resistance and can be slower for simple tasks while the team learns the new tools.

Upgrade the development model

Move from a process-oriented to an object-oriented development model. A resource-based design reduces the effort of understanding relationships between individual APIs. Organizations can encapsulate resource objects themselves or adopt a unified, object-oriented interface provided by the cloud service provider.

Improve development efficiency

Adopting infrastructure as code means the O&M team spends most of its time writing code, including business and test modules. While some engineers embrace this shift, others who are accustomed to manual changes and occasional scripting may find it challenging. The organization may need to invest in upskilling or hiring to bridge this gap.

Reduce the learning curve

Building a custom integration layer on top of a cloud provider's OpenAPI is time-consuming, labor-intensive, and offers low returns. Instead, use the resource-based integration capabilities provided by the cloud service provider, such as Cloud Control API, CADT, and ROS, or popular open source tools like Terraform and Ansible.

For common internal integration issues, you can also improve learning efficiency and outcomes by recording and sharing knowledge, and providing training.