Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

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 from AWS

    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

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    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

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.