If you have some codepipeline already created use the cli to extract them as cloudformation.
The command is roughly this
aws codepipeline get-pipeline --name
It will get you back a codepipeline resource for cloudformation. You will be able to see where you need to enter in other resources like codebuild projects and s3 buckets or codecommit repos.
Be aware though that you will need to work through the template to ensure it will be taken as valid by cloudformation. The lines of the resource from the cli need to start with capital letters so it can be tedious to change that.
Another thing to know is a pipeline needed I think two roles which you can have in your template also and it's own bucket. All of these things cab be put in a single template making reproducible pipelines possible.
Good luck!