Autocomplete AWS CDK L1 Constructs in VS Code
Tags: aws, cloud, vscode
Published: 2022-02-13 11:13:45

---
title: Autocomplete AWS CDK L1 Constructs in VS Code
published: true
date: 2021-05-18 05:52:45 UTC
tags: aws, cloud, vscode
canonical_url: https://towardsthecloud.com/autocomplete-aws-cdk-constructs-vscode
---

I created an extension for AWS CDK that adds all available [L1 constructs](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) from AWS CDK into Visual Studio Code in the form of snippets. Basically, it will **autocomplete** any CloudFormation resource you specify including its properties + values.

The VS Code extension is called [CDK Construct Snippets](https://marketplace.visualstudio.com/items?itemName=dsteenman.cdk-snippets)

[![AWS CDK Constructs Snippets VS Code Marketplace extension](https://cdn.hashnode.com/res/hashnode/image/upload/v1621277228505/dZISK5-wk.jpeg)](https://marketplace.visualstudio.com/items?itemName=dsteenman.cdk-snippets)

For now, the VS Code extension only supports TypeScript. But if you want to help out and make it available for more programming languages, then you can help by contributing [in the GitHub repository](https://github.com/dannysteenman/vscode-cdk-snippets)

## Features

**The VS Code extension contains the following features:**

1. Supports all resources that are defined by CloudFormation in the form of L1 constructs in AWS CDK
2. Triggers autocomplete by invoking `l1-<cloudformation-resource>`
3. The construct snippets are automatically updated every week after AWS updates their [CloudFormation Resource Specification.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html)
4. Has built-in support for placeholders. This means you can quickly jump from property to property in each resource by using `Tab`
5. The extension will show which property is required by adding a `// required` comment next to it.
6. The autocomplete prompt shows the matching AWS CDK resource documentation URL in its description.

## Usage

- **Step 1.** Install [this extension](https://marketplace.visualstudio.com/items?itemName=dsteenman.cdk-snippets)
- **Step 2.** Start working in your AWS CDK project (TypeScript)
- **Step 3.** Start adding L1 constructs in your code by using their prefix name e.g. `l1-s3-bucket` equals to L1 construct `s3.CfnBucket`

[![AWS CDK Construct Snippets example](https://cdn.hashnode.com/res/hashnode/image/upload/v1621277807206/rG-gQat99.gif)](https://marketplace.visualstudio.com/items?itemName=dsteenman.cdk-snippets)

> **Note:** Once you start typing a prefix (explained in step 3), the corresponding snippet shows up in the dropdown menu. If this doesn't happen automatically, press `ctrl + space` to invoke IntelliSense and search for the prefix of the resource type that you want to add (as listed in step 3).

### Have a look at a VS Code extension I made for AWS CloudFormation

If you're working with AWS CloudFormation, then you might be interested in my other VS Code extension that I created which adds autocomplete snippets for all the AWS CloudFormation resources for YAML templates.

[https://towardsthecloud.com/autocomplete-cloudformation-resources-vs-code](https://towardsthecloud.com/autocomplete-cloudformation-resources-vs-code)

* * *

👋 **Enjoyed this article?** Reach out in the comments below or on [Twitter](https://twitter.com/dannysteenman) to let me know what you think of it.