Community Blog How to Manage Cloud-Native Applications Configurations Using Alibaba Cloud Application Configuration Management Service

How to Manage Cloud-Native Applications Configurations Using Alibaba Cloud Application Configuration Management Service

This article explains how to manage cloud-native applications configurations using Alibaba Cloud Application Configuration Management.

By Wamala Emmanuel Nsubuga

What Is Application Configuration Management?

Alibaba Cloud Application Configuration Management (ACM) is a service that allows centralized management of application configurations. For example, if you have multiple applications using the same configuration file or multiple instances of the same application, you can create one configuration file that pushes/distributes to all applications or application instances. In addition, ACM offers several functions, such as configuration push, configuration modification, historical version management, gray release, and configuration modification audit.

Application Configuration Management Features

  • Core Functionalities: Creating, deleting, modifying, and querying configurations
  • Configuration Tags: Organizing configurations with tags helps you manage configurations more efficiently.
  • Supports Multiple Languages: Supports Java/CPP/Python/Shell/HTTP OpenAPI
  • One-Click Rollback: Reduces the risk of changing configurations
  • Change History: Makes everything auditable
  • Data Encryption: Enhances the security of sensitive data

Application Configuration Management Benefits

  • Configuration changes are applied to multiple applications simultaneously.
  • ACM encrypts configurations to secure the information.
  • ACM reduces the possibility of having several versions of a specific configuration file in different applications due to errors in updating the different application configurations.
  • ACM reduces the amount of duplicate work needed to update configurations for each application.
  • Configuration changes take immediate effect when using the ACM configuration listening API.
  • Auditing, version management, and debugging are easier because configuration changes and versions are recorded automatically.

How to Manage Cloud-Native Applications Configurations Using Alibaba Cloud Application Configuration Management Service

Activating ACM

You must activate the ACM service before using it. Go to the ACM product homepage and click Get it Free:


Select I agree with the ACM Agreement of Service and click Enable Now:

Creating a Configuration on ACM

Log on to the ACM console, select Configurations on the left-side navigation pane, and click Create in the upper-right corner:


Enter the following data on the Create Configuration page and click Publish:


Using the API to Listen for Configuration Changes

Run the following command to create a sample project:

mvn archetype:generate -DgroupId=com.acm.sample -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Note: You must install JDK on the server and set the environment variable JAVA_HOME to run Java programs.

Add the ACM client native API dependencies in the pom.xml file:

     <! -- Remove the following if logging implementation is available. -->

Add the raven-assembly-plugin packaging plug-in to the pom.xml file:


Listen for configuration changes with the API:

//-- App.java
package com.acm.sample;

import java.io.IOException;
import java.io.StringReader;
import java.util.Properties;
import com.alibaba.edas.acm.listener.ConfigChangeListener;
import com.alibaba.edas.acm.ConfigService;
import com.alibaba.edas.acm.exception.ConfigException;

public class App {

     private static Properties appCfg = new Properties();

     public static void initAndWatchConfig() {
         final String dataId = "com.acm.myapp.app.cfg";
         final String group = "myapp";
         final long timeoutInMills = 3000;

         // Copy the corresponding values from the namespace page of the console.
         Properties properties = new Properties();
         properties.put("endpoint", "$endpoint");
         properties.put("namespace", "$namespace");
         properties.put("accessKey", "$accessKey");
         properties.put("secretKey", "$secretKey");

         // If it is an encrypted configuration, then add the following two lines for automatic decryption.
         // properties.put("openKMSFilter", true);
         // properties.put("regionId", "$regionId");


         // Get configuration body directly.
         try {
             String configInfo = ConfigService.getConfig(dataId, group, timeoutInMills);
             appCfg.load(new StringReader(configInfo));
         } catch (ConfigException e1) {
         } catch (IOException e) {

Listen for configuration changes to get the latest values:

ConfigService.addListener(dataId, group, new ConfigChangeListener() {
             public void receiveConfigInfo(String configInfo) {
                 try {
                     appCfg.load(new StringReader(configInfo));
                 } catch (Exception e) {
                     // process exception

     public static void refreshApp() {
         System.out.println("current thread pool size: " + appCfg.getProperty("threadPoolSize"));
         System.out.println("current log level: " + appCfg.getProperty("logLevel"));

     public static void main(String[] args) {

         // Make sure the main thread does not exit.
         while (true) {
             try {
             } catch (InterruptedException e) {

Note: The user variables in the code, such as $endpoint, $namespace, and $accesskey, can be found on the namespace page of the ACM console, as shown in the following figure:


Modifying Configuration Changes

On the configurations page of the ACM console, search for the configuration. In the Actions column, click Edit:

Change the configuration body on the Edit Configuration page and click Publish:

Verify the configuration changes are correct in the Content Comparison dialogue box and click Confirm Publishing:

A notification will be displayed:



Alibaba Cloud Application Configuration Management (ACM) simplifies application configuration management with security, centralization (single source of truth), and versioning in one place. This promotes stable and available infrastructure and reduces time spent performing repetitive operations.

0 0 0
Share on

Alibaba Cloud Community

858 posts | 196 followers

You may also like


Alibaba Cloud Community

858 posts | 196 followers

Related Products