DEV Community

Zeke Sebulino
Zeke Sebulino

Posted on

1

AWS Codebuild - List all projects and output into a file.

Hey there! So, I recently had to tackle the challenge of identifying all of our AWS CodeBuilds that were using soon-to-be-deprecated Linux images. Given the large number of builds in our project, manually sifting through each one would have taken forever.

To save time, I turned to the AWS CLI and crafted a command that would help me list out all of our CodeBuilds alongside their corresponding Linux images. This way, I could quickly identify the builds that needed updating.

Here's the command I used:

aws codebuild list-projects | jq '.projects[]' | xargs -I{} sh -c 'aws codebuild batch-get-projects --names "$1" | jq -r "\"\(.projects[].name) : \(.projects[].environment.image)\"" ' _ {} >> list.txt

Enter fullscreen mode Exit fullscreen mode

It's a bit of a mouthful, but essentially what it does is use the list-projects command to fetch all CodeBuild projects, pipe them to jq to extract the project names, and then use xargs to pass each project name to the batch-get-projects command, which fetches the full project details including the Linux image. Finally, I used jq again to format the output as "project name : Linux image", and wrote the results to a file called list.txt.

Hope this helps you save some time too!

Image of Stellar post

From Hackathon to Funded - Stellar Dev Diaries Ep. 1 πŸŽ₯

Ever wondered what it takes to go from idea to funding? In episode 1 of the Stellar Dev Diaries, we hear how the Freelii team did just that. Check it out and follow along to see the rest of their dev journey!

Watch the video

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup πŸš€

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay