Application parameters

Updated at:
Copy as MD

Application parameters store configurations, passwords, and other data for your application. During deployment, they are dynamically injected as environment variables into startup and shutdown scripts to improve flexibility and security.

Create and use application parameters

  1. Go to the ECS console - Application Management page. On the My Applications tab, click the name of the target application to open its details page.

  2. Select the Parameters tab, and then click Create Parameter.

  3. In the Create Parameter panel, configure the following settings, and then click OK.

    • Parameter Description: The parameter name, used as an environment variable in the script. For example, port.

    • Disk Category:

      • Custom Parameters: Stores non-sensitive configuration information.

      • Encryption Parameter: Stores sensitive information such as passwords and API keys in encrypted form.

    • Set different values for each group:

      • Yes: Specify a different value for each application group. For example, for the port parameter, set the value for Group 1 to 8080 and the value for Group 2 to 8081.

      • No: Set a single value for all application groups.

  4. Use the parameter in the deployment package. In the application's startup script, use ${port} to reference it.

    start_application() {
      docker run -d -p ${port}:${port} --name my-application image:latest
    }
    
    start_application

    When you publish a deployment package to different application groups, ${port} resolves to the parameter value of each group. For example, it resolves to 8080 for Group 1 and 8081 for Group 2.