gofireflyio/aiac: 人工智能自动生成基础设施运维代码


aiac是一个命令行工具,可通过OpenAI的 API生成 IaC(基础设施即代码)模板、配置、实用程序、查询等。CLI 允许您要求模型为不同的场景生成模板(例如“为 AWS EC2 获取 terraform”)。它将发出请求,并将生成的代码存储到一个文件中,或者只是将其打印到标准输出。

生成配置文件

  • aiac get dockerfile for a secured nginx
  • aiac get k8s manifest for a mongodb deployment

示例:命令行输入:

aiac get dockerfile for nodejs with comments

alac将输出配置如下:

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" ]

生成 CICD 管道

  • aiac get jenkins pipeline for building nodejs
  • aiac get github action that plans and applies terraform and sends a slack notification

查询生成器
  • aiac get mongo query that aggregates all documents by created date
  • aiac get elastic query that applies a condition on a value greater than some value in aggregation
  • aiac get sql query that counts the appearances of each row in one table in another table based on an id column

需要在此处创建您的 OpenAI API 密钥