AWS Application Composer at Home with VSCode
Tags: devtools, aws, applicationcomposer, vscode
Published: 2024-02-06 20:17:16

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](https://blog.devgenius.io/cloudforming-an-autoscaling-nginx-server-inside-a-custom-vpc-be3510012dd7).
- I have vsCode on Mac as my IDE, and we'll need the [AWS Toolkit](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srhq1sf2cqnde6gkdgox.png)
Upon selection, we should see something like this:

![Application Composer icon in vsCode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7vcq7vqfl7v9ks07uyt.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zat3n445ctxnczsrth3g.png)

![viewing details of element](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xuw8if6u1wznamk33rc7.png)

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:

![screenshot of success message](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oju6n3com19akk9see8u.png)

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!


Cross-posted at [AWS Community](https://community.aws/content/2bxeDkiH57yC56HgN3LEt1wqzxH)