Expand my Community achievements bar.

SOLVED

How to manage a cloud manager variables in aem cloud

Avatar

Level 9

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/usi...)

 

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can use aio cli. https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironments... 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-cloudmanagerenvironmentl... which you can then use to set on other environments using set-variable.
Hope this helps.

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

You can use aio cli. https://github.com/adobe/aio-cli-plugin-cloudmanager?tab=readme-ov-file#aio-cloudmanagerenvironments... 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-cloudmanagerenvironmentl... which you can then use to set on other environments using set-variable.
Hope this helps.

Avatar

Level 9

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

Avatar

Community Advisor

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/pa... 

 

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



Arun Patidar

Avatar

Community Advisor

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/usi...  



Arun Patidar