--- title: "CTP Topic 32 Using Atlantis CICD for Infrastructure Deployments" type: source tags: [Atlantis, CI/CD, IaC, Terraform, GitOps, CTP] date: 2026-04-14 --- ## Source File - [[Cloud & DevOps/Public-Cloud-Learning-Sessions/06_CI_CD_GitOps/ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]] ## Summary(用中文描述) ### 核心主题 Atlantis 作为 Terraform IaC 自动化工具,替代 Jenkins 用于 AWS Landing Zone 的基础设施部署流水线。 ### 问题域 当前 Jenkins 流水线面临两大核心痛点: - **速度慢**:初始化时间长、多次代码克隆、顺序测试、ECS Deployer 预配置导致整个流程极慢 - **复杂度高**:持续叠加功能以覆盖更多场景和边缘用例,导致流水线脆弱且易漂移 ### 方法/机制 - **架构**:Atlantis 以单台 EC2 实例形式部署于每个 Landing Zone 的共享账户,通过 GitHub Enterprise Webhook 接收通知 - **协作模型**:开发者直接在 GitHub Pull Request 上评论即可与 Atlantis 交互,无需单独账号和复杂集成 - **跨账户访问**:通过在每个账户部署的 IAM 角色实现,支持简单和跨账户模块部署 - **权限控制**:用户管理基于 GitHub 构建,构建日志以评论形式存储用于审计 - **并行构建**:支持多模块 plan 和 apply 命令并发执行 ### 结论/价值 Atlantis 提供更好的协作模型、简化的网络架构(Jenkins 需要大量 VPC Endpoints)、代码与基础设施同步更新(merge 前即应用变更),是替换 Jenkins 的理想方案。 ## Key Claims(用中文描述) - Atlantis 团队通过在 PR 上评论即可完成 plan/apply,无需独立的 Jenkins 账号和集成 - Atlantis 在代码 merge 前即执行变更,确保代码始终与基础设施同步 - Atlantis 锁定机制防止多 PR 同时对同一模块执行 plan 产生冲突 - Atlantis 通过 Webhook 接收 GitHub 通知,服务账号负责与 GitHub 交互(评论、合并、关闭 PR) ## Key Quotes > "The current pipeline is practically very slow due to significant initialization time, multiple code cloning, sequential testing, and ECS deployer provisioning." — 当前 Jenkins 流水线的性能痛点 > "Atlantis applies changes before merging, ensuring code in sync with infrastructure." — Atlantis 的核心价值主张 > "When a plan is run, the directory of each module is locked until the pull request that has this folder locked is merged or closed, or the plan is manually discarded." — Atlantis 锁定机制 ## Key Concepts - [[Infrastructure-as-Code]]:通过 Terraform 代码声明式管理 AWS 基础设施,Atlantis 是其 CI/CD 执行层 - [[GitOps]]:以 Git 为单一事实来源,通过 PR 协作和 Atlantis 自动化 apply 实现 GitOps 工作流 - [[CI/CD Pipeline]]:持续集成/持续部署流水线,Atlantis 替代传统 Jenkins 流水线用于 IaC 场景 - [[Terraform]]:HashiCorp 的基础设施即代码工具,Atlantis 的核心执行对象 ## Key Entities - [[Terraform]]:Atlantis 管理的基础设施即代码工具,替代手动控制台操作 - [[Jenkins]]:被 Atlantis 替代的现有 CI/CD 系统,存在初始化慢和架构复杂的问题 - [[GitHub Enterprise]]:Atlantis 的事件来源,通过 Webhook 通知 Atlantis 执行 plan/apply ## Connections - [[ctp-topic-33-an-introduction-to-gitops]] ← extends ← [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]](Topic 33 介绍 GitOps 概念,Topic 32 展示 Atlantis 工具实现) - [[ctp-topic-9-ci-cd-with-gruntwork]] ← extends ← [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]](Topic 9 介绍 Gruntwork CI/CD,Topic 32 进一步细化为 Atlantis 替代方案) - [[ctp-topic-3-deploy-and-maintain-infrastructure]] ← depends_on ← [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]](Topic 3 部署和维护基础设施,Topic 32 提供具体 CI/CD 工具) - [[ctp-topic-16-cross-account-terraform-modules]] ← relates_to ← [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]](跨账户 Terraform 模块与 Atlantis 跨账户访问机制关联) ## Contradictions - 与 [[ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone]]: - **冲突点**:EKS 部署是否支持 Atlantis - **当前观点(Topic 39)**:Atlantis 当前不支持 EKS 部署,需通过 Jenkins + Terragrunt 模块替代 - **对方观点(Topic 32)**:Atlantis 可替代 Jenkins 用于所有 Terraform IaC 部署 - **分析**:两者描述的语境不同——Topic 39 聚焦特定 EKS 场景下的实践经验,Topic 32 描述 Atlantis 整体优势。可能 Atlantis 在某些复杂场景(如 EKS 特定依赖)下存在限制,需进一步验证 ## Source Metadata - **Category**: DevOps & SRE / 06_CI_CD_GitOps - **Type**: Video(CTP Learning Session) - **Status**: Summarized(Gemini 摘要) - **Video Source**: NAS `/volume2/work/Public Cloud Learning Sessions/CTP _ Topic 32_ Using Atlantis CICD for infrastructure deployments.mp4`