Search code examples
pythonbashamazon-web-servicesaws-nuke

How to run aws-nuke without providing inputs during execution?


I'm trying to run https://github.com/rebuy-de/aws-nuke ans pass answers to interactive prompts. Script is asking for alias of an account (twice). Unfortunately it passes only first answer, second is omitted. Error I got:

Do you want to continue? Enter account alias to continue. Error: EOF

Function is in AWS Lambda:

command='/tmp/aws-nuke -c /tmp/config.yml --no-dry-run --access-key-id '+newsession_id+' --secret-access-key '+newsession_key+' --session-token '+newsession_token+'''<< EOF 
    alias
    alias
    EOF'''

    popen = subprocess.Popen(command, shell=True)

Solution

  • I am a maintainer of aws-nuke. You do not need to dynamically provide the requested input. When adding the --force flag, it won't ask you, but simply waits some seconds as a safety measurement.