Artificial Intelligence Infrastructure-as-Code Generator.
aiac
is a command line tool to generate IaC (Infrastructure as Code) templates, configurations, utilities, queries and more
via OpenAI's API. The CLI allows you to ask the model to generate templates
for different scenarios (e.g. "get terraform for AWS EC2"). It will make the
request, and store the resulting code to a file, or simply print it to standard
output.
aiac terraform for a highly available eks
aiac pulumi golang for an s3 with sns notification
aiac cloudformation for a neptundb
aiac dockerfile for a secured nginx
aiac k8s manifest for a mongodb deployment
aiac jenkins pipeline for building nodejs
aiac github action that plans and applies terraform and sends a slack notification
aiac opa policy that enforces readiness probe at k8s deployments
aiac python code that scans all open ports in my network
aiac bash script that kills all active terminal sessions
aiac kubectl that gets ExternalIPs of all nodes
aiac awscli that lists instances with public IP address and Name
aiac mongo query that aggregates all documents by created date
aiac elastic query that applies a condition on a value greater than some value in aggregation
aiac sql query that counts the appearances of each row in one table in another table based on an id column
First, install aiac
:
brew install gofireflyio/aiac/aiac
Or using docker
:
docker pull ghcr.io/gofireflyio/aiac
Or using go install
:
go install github.com/gofireflyio/aiac/v2
Alternatively, clone the repository and build from source:
git clone https://github.com/gofireflyio/aiac.git
go build
- Create your OpenAI API key here.
- Click “Create new secret key” and copy it.
- Provide the API key via the
OPENAI_API_KEY
environment variable or via the--api-key
command line flag.
By default, aiac prints the extracted code to standard output and asks if it should save or regenerate the code:
aiac terraform for AWS EC2
To store the resulting code to a file:
aiac -o aws_ec2.tf terraform for AWS EC2
To run using docker
:
docker run \
-it \
-e OPENAI_API_KEY=[PUT YOUR KEY HERE] \
ghcr.io/gofireflyio/aiac terraform for ec2
Command line prompt:
aiac dockerfile for nodejs with comments
Output:
FROM node:latest
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5 )
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "node", "index.js" ]
We have two main channels for supporting AIaC:
- Slack community: general user support and engagement.
- GitHub Issues: bug reports and enhancement requests.
This code is published under the terms of the Apache License 2.0.