Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to automate AWS network using Ansible Automation

September 12, 2023
Deepankar Jain Himanshu Yadav
Related topics:
Automation and management
Related products:
Red Hat Ansible Automation PlatformRed Hat Ansible Automation Platform via AWS

Share:

    In today's rapidly evolving technology landscape, Red Hat Ansible Automation Platform offers a powerful solution for managing network configurations in Amazon Web Services (AWS). In this article, we will explore how you can leverage the capabilities of Ansible Automation Platform to simplify and automate your network configuration tasks in AWS.

    We will guide you through the process of setting up the necessary credentials for your AWS account within the Ansible Automation Platform. We will then dive into playbook execution, demonstrating how you can execute playbooks to define and automate your network configurations in AWS. By the end of this article, you will have the knowledge and confidence to use Ansible Automation Platform to manage your network configurations in AWS effectively.

    Prerequisites

    1. Before you can complete any of the following tasks, you must create a registry service account. To log in to SA, open your terminal and type the following commands:
    podman login registry.redhat.io
    Username: {REGISTRY-SERVICE-ACCOUNT-USERNAME}
    Password: {REGISTRY-SERVICE-ACCOUNT-PASSWORD}  
    Login Succeeded!

    Once you log into SA, create a container image by using a Containerfile containing the following context:

    FROM registry.redhat.io/ansible-automation-platform-22/ee-supported-rhel8:latest
    RUN ansible-galaxy collection install community.aws
    RUN ansible-galaxy collection install amazon.aws

    To build an image using podman, enter the following command:

    podman build -t <image-name> 

    The image should be pushed into the container image registry. Log in to the private container image registry using the podman login command before pushing.

    For this demonstration, we will use quay.io as our registry, but you can use any other container registry.

    podman push <image-name>

    Navigate to Execution Environments under the Administration Tab and click on the Add button.

    Add the image name in the execution environment (Figure 1).

    Figure 1: The execution environment
    Figure 1: The execution environment.
    1. You must have an active AWS account.
    2. Generate the access key and client secret for AWS.
    3. Navigate to the Credentials tab, and under the Add button and select Amazon Web Services.
    4. Add your access key and secret key, then save the credentials (Figure 2).
    Figure 2: AWS Credentials
    Figure 2: AWS credentials.

    How to use Ansible to manage network configuration

    First, we will create and configure the project by following these steps:

    1. Navigate to the Projects tab under Resources in the left pane.
    2. Click on Add to create a new project.
    3. Enter a name for the project and choose Git as the source control type with URL: https://github.com/decipher07/Manage-SSH-Keys-Ansible in the Source Control URL field (Figure 3).
    4. Save the changes and wait for the operation to complete successfully.
    Figure 3: Setup the Project Configurations
    Figure 3: Set up the project configurations.

    Next, create and configure the job templates as follows (Figure 4):

    1. Go to the Templates tab under Resources in the left pane and click on the Add button and select Job template from the options.
    2. Enter a name for the job you want to create and select the Demo-Inventory or Default inventory in the Inventory section.
    3. In the Project section, click on the project name you previously created and select the get_sys_data.yml file.
    4. In the Execution Environment section, click on the execution environment name you previously created.
    5. In the Credentials section, select the Amazon Web Service category and choose the credentials for AWS.
    6. Click on the Variables section and add the variables as follows:
      ---
      region: ap-south-1
      instance_type: t3.micro
      ami: ami-0f9d9a251c1a44858
      key_name: ansible-demo
      vpc_name: ansible-vpc-test
      cidr_block: "10.10.0.0/16"
      cidr: "10.10.0.0/24"
    Figure 4: Setup the Job template
    Figure 4: Set up the job template.

    Finally, we can launch the playbooks by clicking on the launch button. You can view the logs of the output as follows (Figure 5):

    The Ansible Playbook output log.
    Figure 5: The playbook output log.

    Continue your automation journey with Ansible

    Get started with Ansible Automation Platform by exploring interactive hands-on labs. Download Ansible Automation Platform at no cost and begin your automation journey. You can refer to An IT executive's guide to automation e-book for better understanding of Ansible Automation. Additionally, check out our article series where we explain how to provision AWS infrastructure using the Ansible Automation Platform, empowering you to efficiently manage your cloud resources.

    Last updated: January 11, 2024

    Related Posts

    • How to create an EC2 instance in AWS using Ansible CLI

    • Automating microservices deployment with Ansible

    • The benefits of deploying Ansible Automation Platform on AWS

    • Using Ansible to automate Google Cloud Platform

    Recent Posts

    • vLLM Semantic Router: Improving efficiency in AI reasoning

    • Declaratively assigning DNS records to virtual machines

    • How to deploy language models with Red Hat OpenShift AI

    • AI search with style: Fashion on OpenShift AI with EDB

    • What qualifies for Red Hat Developer Subscription for Teams?

    What’s up next?

    Why automate? Which tool do I use? This e-book dives into various automation options, how they work, what to automate, and the benefits of each tool.

    Download the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue