Dan
Dan

Reputation: 137

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

I have jenkins installed on an AWS EC2 Instance. My end state is whenever I commit cloudformation templates to my bitbucket repo, jenkins will automatically create/update/delete cf stack.

My thoughts on it was via aws cf cli commands in the jenkinsfile after installing aws cli on the server. Is there a better way of approaching this? I am new to devops

Upvotes: 4

Views: 3993

Answers (2)

Tj Kellie
Tj Kellie

Reputation: 6476

I would say using CLI commands in your Jenkins pipelines is a good practice.

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. From there just execute the CloudFormation stack in a Jenkins task.

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.

Upvotes: 1

hakamairi
hakamairi

Reputation: 4678

You could try AWS Cloudformation Plugin, but it's up for adoption and wasn't updated in 3 years.

I would say your approach with using the AWS cf cli commands looks safer.

Upvotes: 1

Related Questions