DEV Community

Ray Del Rosario
Ray Del Rosario

Posted on

1

Cómo usar AWS Cli en AWX

Existen ciertos momentos donde queremos usar una función de AWS y no está disponible como módulo en Ansible, en esos casos solemos usar command, pero al momento de integrarlo en AWX, nos saldrá un error de: You must specify a region. You can also configure your region by running \"aws configure\"."
Para solucionarlo, utilizaremos environment, esto solo funcionará para la tarea en específico, no para el playbook en conjunto.

---
- name: Ejecutar comando
  command:  aws ec2 describe-instance-status --instance-id "{{ instance_id }}"
  environment:
    AWS_DEFAULT_REGION: "{{ region }}"
    AWS_ACCESS_KEY_ID: "{{ aws_access_key  }}"
    AWS_SECRET_ACCESS_KEY: "{{ aws_secret_key }}"
Enter fullscreen mode Exit fullscreen mode

Con esto ya debería funcionar sin problemas.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay