[英]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.