You can use application parameters to store information such as application configurations and passwords. During deployment, these parameters are injected as environment variables into the application's startup and shutdown scripts. This process improves deployment flexibility and security.
Create and use application parameters
Go to the ECS console - Application Management page. On the My Applications tab, click the name of the target application to open the application details page.
Select the Parameters tab, and then click Create Parameter.
In the Create Parameter panel, configure the following parameters, and then click OK.
Parameter Name: The name of the parameter, which is used as an environment variable in the script. For example,
port.Type:
Custom Parameters: Stores non-sensitive configuration information.
Encryption Parameter: Stores sensitive information, such as passwords and API keys. The parameter value is encrypted to improve security.
Set different values for each group:
Yes: Specify a different value for each group. For example, for the
portparameter, set the value forGroup 1to8080and the value forGroup 2to8081.No: Set a single value for all application groups.
Use the parameter in the deployment package. In the application startup script, use
${port}to reference the parameter.function start_application() { docker run -d -p ${port}:${port} --name my-application image:latest } start_applicationWhen you publish the deployment package to different application groups,
${port}in the script is parsed into the value specified for the corresponding group. For example, when you publish to Group 1, the value of${port}is8080. When you publish to Group 2, the value is8081.