Composing at Home

Composing at Home

How AWS' Application Composer can now be used in VSCode

Published Feb 6, 2024
One of the many struggles I see with almost any job field is the battle of getting your tools and workspace optimized, and then trying to add in a new tool. A second struggle that I've seen, especially firsthand, is visualization. I am very much a visual person, and I generally have to sketch out diagrams for projects I am working on so that I can wrap my brain around it, and figure out where I might have gone wrong or where I need to go.
If I haven't lost you, let me tell you what I mean, and how I hope to trumpet a great new advancement for us Cloud folks! For example, in fields like software development and devops, a good IDE or editor is vital, and in my case, I prefer vsCode for it's many plugins that make it easy to use with a multitude of services and for a multitude of purposes. However, AWS' tool called Application Composer was previously only web-based, leading to that battle of either having to switch back and forth, or maybe just going without a very useful tool if it proves to be too much of an inconvenience. As I mentioned before, I'm a very visual learner, so to me, it was worth it.
The great news is that now, that same great tool is available directly in vsCode! This article will walk through using one of my old projects to test out/review Application Composer via vsCode. I hope that you enjoy my journey, and maybe discover a new tool for your utility belt!

The setup bit.

To begin, I'll be using one of my old projects, found here.
I have vsCode on Mac as my IDE, and we'll need the AWS Toolkit from the Visual Studio Marketplace.
Be sure you have the AWS and SAM CLIs installed as well!
Lastly, we need some credentials! A few of the tools that come in the toolkit only need an AWS Builder login, but for the most robust usage, we will need to be able to log in to a full AWS account.
Note: While the Composer can be used with a Builder ID or an IAM Identity Center login, if you wish to deploy using sam sync, you will need a set of regular IAM credentials with access key.

The fun bit!

Let's jump in! While I am excited to use this tool to create fresh projects, it's fantastic to be able to visualize and work on existing projects. This particular number is an AWS Cloudformation template that creates a VPC with 2 subnets, security group and an autoscaling group.
First, let's open up our yaml file, and we are going to select the 'Application Composer' icon in the top right of our window.
image of vsCode window with icon for tool
Application Composer icon in vsCode
Upon selection, we should see something like this:
Application Composer in vsCode
On the left, we can see tabs for List, which will show us all the current elements, and the Resources tab, which is where we can easily add components. The main beauty of course, is the main window, with each component being an editable, movable "building block". This allows us to easily work on each component without having to rely on line numbers and potentially (lots) of scrolling to work on the item we need!
For example the VPC block "BATTLEGRP" (while it may not be convention, I'm a huge Halo nerd, and many of my projects are named/structured as such haha) contains all our subnets, routing tables, gateways, etc. We can easily drill down on these too, as shown below.
screenshot of selecting details of element
viewing details of element
View of properties for element
Under the properties, another fun option is the ability to use AI to help generate code samples for your project. Useful if you get stuck or don't know where to start on an element you're wanting to add to your project!

The fingers crossed bit

Now with all good development, it should end with a deployment of the resources, right? App or site launch, infrastructure stood up, etc. Well here we come to another great feature built right in.
Your application can be deployed directly from vsCode via the rocket ship icon at the top, which kicks off a sam sync command. Through vsCode it will take you through choosing a region, a stack, and a bucket for deploying your stack. If it's a new stack, it will fully deploy, but otherwise it just updates the stack, so watch out for drift! But if all goes well:
Huzzah! We have success! I also decided to jump into the console and confirm that all the resources created correctly. I love it when a plan comes together! ;)
If you choose not to do that, then the AWS CLI or uploading the file to the AWS console are still solid options for deployment.

The final bit.

 Cleanup and tear-down! Always an important part when testing/working in AWS, and for mine, since I had already jumped into the console, I just deleted my stack from the CloudFormation console, and went about my day. It's important to note that this tool is a development tool, and not a "management" tool. I couldn't find a way to delete my stack from vsCode, but that's alright. It's an amazing tool.
Well folks, I hope that you enjoyed taking this journey with me, that you found something valuable in it, and that if you have any questions, comments, concerns, you reach out!
Thanks for reading!