AWS Logo
Menu
Using AI to Automate Cisco IOS XR Backups

Using AI to Automate Cisco IOS XR Backups

Imagine using AI and your natural language to create an automated system to back up Cisco network device configurations daily.

Du'An Lightfoot
Amazon Employee
Published Mar 19, 2025
Last Modified Mar 25, 2025
In today's fast-paced IT environments, automating routine tasks is essential for maintaining network reliability and security. I recently collaborated with Amazon Q Developer CLI to set up an automated backup system for Cisco device configurations. The interesting thing about this is I only needed to use my natural language to accomplish this. This approach highlighted how AI assistants can significantly streamline technical workflows and enhance productivity.

The Challenge: Daily Configuration Backups

Network device configurations are critical assets that need regular backups. Manual backups are time-consuming and prone to human error or neglect. I needed a solution that would:
  1. Connect to a Cisco router using SSH
  2. Retrieve the complete running configuration
  3. Save it with timestamps for version tracking
  4. Run automatically on a daily schedule
Instead of diving into documentation or writing code from scratch, I simply expressed this need in plain English to Amazon Q Developer CLI.

Automation Flow

The following diagram illustrates the data flow from our automation system to the Cisco DevNet Always-On sandbox device and back to my local device - all of which was created from my natural language instructions:
workflow
Automation Workflow

The Power of Natural Language for Network Automation

What struck me most was how I could simply describe what I wanted to achieve in plain English. My initial request was straightforward:
Ok lets create a script using python and nornir to get the Cisco device's running-config and schedule this to run daily.
This single prompt set in motion a complex series of technical actions. Amazon Q Developer CLI agent understood that I wanted to:
  • Use Python as the programming language
  • Leverage the Nornir framework for network automation
  • Retrieve running configurations from network devices
  • Create a scheduling mechanism for daily execution
All of this technical understanding came from a simple, conversational request.

How Our Conversation Guided the Development

Our interaction was remarkably conversational, with me providing high-level guidance while the CLI agent handled the technical implementation:

Setting Up the Environment

When I wanted to use a proper development environment, I simply said: lets set this up in a venv - no need to remember virtual environment commands or syntax.
The agent immediately:
  • Created a Python virtual environment
  • Activated it
  • Installed all necessary dependencies (nornir, nornir-netmiko, nornir-utils, python-dotenv)

Locating Credentials

When Amazon Q needed to find my credentials, I just pointed it in the right direction: its in /Documents/temp. No need to provide exact file paths or explain file formats - Amazon Q understood the context and located the necessary files.

Testing the Implementation

To verify our solution worked, I simply said: ok lets run this to see it works.
Amazon Q then:
  • Executed the script
  • Connected to the Cisco device
  • Retrieved the configuration
  • Saved it with a timestamp
  • Showed me the results

Documentation and Visualization

When I wanted to document our work so I could share with, I just asked: write a blog about what we just did. How we were able to work together to create this solution.
Later, I refined this with: Please add to the blog a mermaid diagram show the code structure. Also add one showing the flow from device to Cisco.
Each request was met with appropriate technical actions - all without me having to specify exact commands, syntax, or technical details.

The Technical Solution Behind My Natural Language Prompts

While I used natural language, Amazon Q was building a sophisticated technical solution. Here's the Python script it created from my simple requests:
Notice how the code includes sophisticated features I never explicitly requested:
  • Handling pagination issues specific to Cisco IOS-XR devices
  • Creating timestamped filenames for version tracking
  • Proper error handling and exit codes
  • Loading credentials securely from environment variables
Amazon Q also created the necessary inventory files for Nornir:
And a shell script for scheduling:
All of these technical components came from natural language requests, not from me providing specific technical instructions.

Code Structure Through Natural Language

The solution we built has a clean, modular structure that makes it easy to maintain and extend. Here's a diagram showing how the different components relate to each other - again, all created through natural language interaction:
Code Structure Through Natural Language
Code Structure Through Natural Language
This structure separates the core functionality (Python script), configuration (inventory files and environment variables), execution (shell script), and scheduling (crontab), following good software engineering practices - all from conversational guidance.

Technical Insights Without Technical Specifications

What impressed me most was how Amazon Q understood networking concepts without me having to explain them:
  1. Pagination Handling: When retrieving configurations from Cisco devices, pagination can truncate output. Amazon Q automatically included code to disable pagination with "terminal length 0" - something I never explicitly mentioned.
  2. Platform-Specific Logic: The code includes conditional logic for IOS-XR devices, showing an understanding of platform differences.
  3. Secure Credential Management: Amazon Q implemented proper credential handling using environment variables rather than hardcoding them.
  4. Error Handling: The script includes proper error detection and exit codes for automation reliability.
All of these technical best practices came from Amazon Q's understanding of my intent, not from explicit instructions.

Benefits of Natural Language Network Automation

This approach to network automation offers several advantages:
  1. Reduced Knowledge Barriers: You don't need to be an expert in Python, Nornir, or cron scheduling to create sophisticated automation.
  2. Faster Implementation: I went from concept to working solution in minutes, not hours or days.
  3. Focus on Intent: I could focus on what I wanted to accomplish rather than how to implement it.
  4. Built-in Best Practices: Amazon Q incorporated technical best practices I might have overlooked.
  5. Adaptability: When requirements changed or issues arose, I could express the changes in natural language.

Reflections on Natural Language Programming

This experience changed how I think about automation tasks. Instead of:
  • Searching for the right libraries and commands
  • Writing boilerplate code
  • Debugging syntax errors
  • Figuring out scheduling syntax
I could focus on the problem I was trying to solve and let Amazon Q handle the implementation details.
The most impressive part was how Amazon Q Developer CLI understood networking concepts like pagination in Cisco devices and implemented appropriate solutions without me having to specify them. When I said Ok lets create a script using python and nornir to get the Cisco device's running-config and schedule this to run daily, Amazon Q knew exactly what libraries to use, how to structure the code, and how to handle device-specific requirements.

The Future of Network Engineering

This experience suggests a fundamental shift in how network engineers might work in the future:
  1. Natural Language as a Primary Interface: Instead of CLI commands or programming languages, natural language could become the primary interface for network automation.
  2. Focus on Architecture and Requirements: Engineers can focus more on the "what" and "why" rather than the "how."
  3. Reduced Learning Curve: New engineers might need less time to become productive, as they can leverage AI to handle implementation details.
  4. Democratized Automation: Network automation becomes accessible to those without strong programming backgrounds.

Conclusion

Working with Amazon Q Developer CLI showed me that natural language is becoming a powerful interface for technical tasks. I could express my intent in plain English, and the AI translated that into working code, proper configurations, and scheduled tasks.
For network engineers, this means less time spent on repetitive coding tasks and more time focusing on architecture and requirements. As these tools continue to evolve, I expect natural language to become an increasingly important skill for technical professionals - perhaps even more important than memorizing specific programming syntax or command structures.
The future of network automation might be less about knowing every command and more about clearly expressing what you want to accomplish. My simple prompt `Ok lets create a script using python and nornir to get the Cisco device's running-config and schedule this to run daily` unlocked a complete, production-ready solution - demonstrating the power of natural language as a programming interface.
To get started with Amazon Q Developer CLI
PS: This post was mostly written by Amazon Q Developer CLI after we performed the automation tasks above.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

2 Comments