How to manage a cloud manager variables in aem cloud | Community
Skip to main content
Mario248
Level 7
October 1, 2024
Solved

How to manage a cloud manager variables in aem cloud

  • October 1, 2024
  • 2 replies
  • 1120 views

I want to create a 50 cloud manager variables., I know how to create a cloud manager variable manually (https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/using-cloud-manager/manage-environments)

 

I am looking for two things:

  1. Creating 50+ variables manually increases the risk of human error. Is there a way to create these variables in bulk, or is there any code to help automate the creation of a large number of Cloud Manager variables?

  2. If I set up all 50+ variables in the dev environment, is there a way to export and import them into other environments, like stage and prod?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by h_kataria

You can use aio cli. https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironmentset-variables-environmentid It accepts json and yaml files as inputs which you can use to set bulk.
To reuse from dev you can use list-variables with json output https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironmentlist-variables-environmentid which you can then use to set on other environments using set-variable.
Hope this helps.

2 replies

h_kataria
Community Advisor
h_katariaCommunity AdvisorAccepted solution
Community Advisor
October 1, 2024

You can use aio cli. https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironmentset-variables-environmentid It accepts json and yaml files as inputs which you can use to set bulk.
To reuse from dev you can use list-variables with json output https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironmentlist-variables-environmentid which you can then use to set on other environments using set-variable.
Hope this helps.

Mario248
Mario248Author
Level 7
October 1, 2024

Thanks for your response. can you share me any sample file for json or yaml?

arunpatidar
Community Advisor
Community Advisor
October 1, 2024

Hi @mario248 
As @h_kataria mentioned , yuou need to rely on CLI or API to create variable in bulk

API References : https://developer.adobe.com/experience-cloud/cloud-manager/reference/api/#tag/Variables/operation/patchEnvironmentVariables 

 

API and CLI accept json, where you can create/modify all the variable using a single command.

Arun Patidar
arunpatidar
Community Advisor
Community Advisor
October 1, 2024

Sample Json file


[ { "name": "APP_USER", "value": "aaaa-prod@bbbbb.com", "type": "string" }, { "name": "APP_PASSWORD", "value": "xxxxxxxxxx", "type": "string" }, { "name": "LOG_LEVEL", "value": "2", "type": "string" }, { "name": "ENV_TYPE", "value": "dev", "type": "string" }, { "name": "MY_VAR1", "value": "myValue", "type": "string", "service": "author" } ]

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/using-cloud-manager/environment-variables#add-variables  

Arun Patidar