Search code examples
command-line-interfacecloudcustodian

How to both configure ACCESS_KEY and SECRET_ACCESS_KEY, and Run a yml file using single command in Cloud Custodian


I want to configure and run a cloud custodian script both within a batch(.bat) file.

AWS_ACCESS_KEY_ID="foo" AWS_SECRET_ACCESS_KEY="bar" custodian run --output-dir=. custodian.yml

Cloud custodian documentation says it is possible with this command but once I use this command with windows CLI, I get an error

"'AWS_ACCESS_KEY_ID' is not recognized as an internal or external command, operable program or batch file." Help me resolve this..


Solution

  • SOLVED

    In windows, to set a variable at the command line you will want to add the word set before your variables and if you want to set both those variables and execute custodian on one line you will need to add && between your commands So something like this might work -

    set AWS_ACCESS_KEY_ID="foo" && set AWS_SECRET_ACCESS_KEY="bar" && custodian run --output-dir=. custodian.yml