简体   繁体   English

如何从 jenkins 部署(创建/更新/删除)cloudformation 模板到我的 AWS 环境?

[英]How can I deploy (create/update/delete) cloudformation templates from jenkins to my AWS environment?

I have jenkins installed on an AWS EC2 Instance.我在 AWS EC2 实例上安装了 jenkins。 My end state is whenever I commit cloudformation templates to my bitbucket repo, jenkins will automatically create/update/delete cf stack.我的最终状态是每当我将 cloudformation 模板提交到我的 bitbucket 存储库时,jenkins 将自动创建/更新/删除 cf 堆栈。

My thoughts on it was via aws cf cli commands in the jenkinsfile after installing aws cli on the server.我的想法是在服务器上安装 aws cli 后通过 jenkinsfile 中的 aws cf cli 命令。 Is there a better way of approaching this?有没有更好的方法来解决这个问题? I am new to devops我是 DevOps 新手

You could try AWS Cloudformation Plugin , but it's up for adoption and wasn't updated in 3 years.您可以尝试AWS Cloudformation Plugin ,但它正在被采用并且在 3 年内没有更新。

I would say your approach with using the AWS cf cli commands looks safer.我会说您使用 AWS cf cli 命令的方法看起来更安全。

I would say using CLI commands in your Jenkins pipelines is a good practice.我会说在 Jenkins 管道中使用 CLI 命令是一个很好的做法。

I am a fan of setting up Jenkins pipelines using the S3 artifact manager so your pipeline artifacts like CF templates are automatically available from S3.我很喜欢使用S3 工件管理器设置 Jenkins 管道,这样您的管道工件(如 CF 模板)就可以从 S3 自动获得。 From there just execute the CloudFormation stack in a Jenkins task.从那里只需在 Jenkins 任务中执行 CloudFormation 堆栈。

If your hosting Jenkins in AWS it's also nice to just add an IAM role to the instance to control what API actions Jenkins is allowed to run and use a plugin like CloudBees AWS CLI for your pipeline tasks.如果您在 AWS 中托管 Jenkins,也可以向实例添加 IAM 角色以控制允许 Jenkins 运行的 API 操作,并使用CloudBees AWS CLI等插件来执行管道任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 "我应该如何通过 cloudformation 部署我的 aws 状态机?" - How should I deploy my aws state machines through cloudformation? 如果已经发生更新,我该如何重试AWS CloudFormation更新? - How can I retry a AWS CloudFormation update if an update is already happening? 如何从 AWS CloudFormation Registry 中删除模块? - How to delete a Module from the AWS CloudFormation Registry? 当模板相互导出值时如何上传/部署和组织 AWS CloudFormation 模板 - How to upload/ deploy and organise the AWS CloudFormation templates when the templates are exporting values mutually 如何将 aws lambda 部署为詹金斯的代理? - How can I deploy aws lambda as jenkins's agent? AWS CloudFormation模板:如何获取模板信息? - AWS CloudFormation templates: how to get templates info? 如何为特定 CloudFormation 堆栈创建“aws.cloudformation”CloudWatch 事件类型? - How can I create an "aws.cloudformation" CloudWatch event type for a specific CloudFormation stack? 我们如何合并两个或多个 aws cloudformation 模板 - how can we merge two or more aws cloudformation templates 我如何使用 cloudformation 创建和更新 WAF IPset - how can i create and update WAF IPset using cloudformation 如果我在 AWS 组织中创建 AWS 账户,我可以从拥有该组织的根账户中删除它吗? - If I create an AWS account in AWS organizations, can I delete it from my root account which owns the organization?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM