AWS Toolkit for Visual Studio Code

repository·master·Indexed 24 days ago

https://github.com/aws/aws-toolkit-vscode

A VS Code extension that integrates AWS services into the IDE. It enables developers to manage resources (S3, Lambda, CloudFormation, API Gateway, Redshift), debug serverless functions via SAM CLI, and connect to EC2 or ECS instances. Key features include Infrastructure Composer for visual architecture design, Step Functions Workflow Studio, and Threat Composer for threat modeling as code. The repository also includes the @amzn/amazon-q-developer-streaming-client for interacting with Amazon Q Developer services.

Tokens
102.9K
Snippets
170
Records
580
Agent score
83%

What's inside aws-toolkit-vscode

  1. Overview of Appbuilder-Test-App

    master

    The Appbuilder-Test-App is a specialized blank app template used specifically for integration testing within the appBuilderNode.test.ts suite. It is designed to demonstrate the generation of four distinct types of resource nodes in the Application Builder 'Explore' and 'AWS Explore' views.

    Warning: Do not modify the template.yaml or samconfig.toml files within this directory, as doing so will cause integration tests to fail.

  2. Understand the scope of the S3 Explorer UX

    master

    The S3 Explorer in the AWS Toolkit for VS Code is designed around the idiomatic VS Code tree/explorer interface in the left column.

    Current Limitations & Out-of-Scope Features:

    • No Eager-loading: High-level properties like empty or count are not eagerly loaded.
    • No Sorting: Items cannot currently be sorted by name or other properties.
    • No Move Operation: To "move" an object, you must manually copy the object to the new location and then delete the original.
    • No List/Browser View: The interface relies on the tree view rather than a bespoke table-based browser view.
    • No Direct Property Editing: You cannot edit permissions or other properties of S3 buckets/objects directly through this interface.
    • No Passive Sync: There is no automatic synchronization (e.g., local filewatchers) to upload S3 objects when local files change.
  3. Install and use AWS Toolkit for Visual Studio Code

    master

    AWS Toolkit is a VS Code extension that connects your IDE to your AWS resources. You can use it to:

    • Authenticate: Connect using IAM credentials, IAM Identity Center (SSO), or AWS Builder ID.
    • Compute & Environments: Connect to EC2 instances, CodeCatalyst Dev Environments, or open a terminal on EC2 instances and ECS tasks.
    • Serverless: Debug Lambda functions using the SAM CLI.
    • Infrastructure as Code: Author, validate, and deploy CloudFormation templates using the CloudFormation Language Server.
    • Observability: Search Log Groups in CloudWatch and browse your AWS resources directly from the IDE.
  4. Understand the AWS Toolkit testing architecture

    master

    The AWS Toolkit for VSCode uses a multi-tiered testing strategy to balance developer feedback speed with release confidence. The test suite is categorized into five main types:

    1. Unit Tests (src/test/): Fast tests where the Toolkit is treated as a library. The vscode API is available via a proxy. These are the primary way to test logic quickly.
    2. Lint Tests (src/testLint): Tests focused on code quality and formatting. Run via npm run lint.
    3. Integration Tests (src/testInteg/): Slower tests that run in a full VSCode instance with an activated extension. These trigger actual VSCode commands and UI elements instead of calling functions directly.
    4. E2E Tests (src/testE2E): Heavyweight end-to-end tests.
    5. Performance Tests (src/testInteg/perf): A subset of integration tests that monitor CPU, memory, and duration to catch regressions.

    Most testing code is located in the packages/core/ subproject due to the monorepo structure.

  5. Use the Amazon SageMaker SSH Plugin for Kiro

    master

    The Amazon SageMaker SSH Plugin for Kiro enables secure remote development by providing SSH connectivity between a local Kiro IDE environment and Amazon SageMaker Spaces. This allows you to develop, train, and deploy machine learning models on SageMaker's managed infrastructure directly from your local IDE.

    Important Compatibility Note: This extension is specifically designed for Kiro IDE users. If you are using Visual Studio Code, you should use the Microsoft Remote - SSH extension instead of this plugin.

  6. Organize code by topic and module

    master

    Maintain a clean project structure using these file organization rules:

    • Topic-based files: Most code related to a topic "Foo" should reside in foo.ts.
    • Utility organization:
      • Broadly usable utilities not strongly dependent on "Foo" types: src/utilities/foo.ts.
      • Utilities strongly dependent on "Foo" types: src/foo/util.ts.
      • Note: src/foo/utilities/ is discouraged.
    • Module grouping: Do not define concepts one-per-file. Related classes, interfaces, and symbols should live in the same module unless there is a clear reason to separate them.
    • Type Aliases: Use the ClassToInterfaceType type alias when an interface directly corresponds to a class to reduce churn during implementation changes.
  7. Resource association fallback behavior

    master

    If the Toolkit is unable to determine whether or not a resource is associated with a pipeline (for example, if the user's IAM identity lacks ResourceGroupsTaggingAPI permissions), the following fallback logic is applied:

    1. The issue is logged as a warning.
    2. The user is not notified (to prevent spamming users who cannot affect their environment).
    3. The Toolkit behaves as if the resource is not associated with a pipeline.

    This ensures that deployment intentions are not blocked by permission issues related to metadata discovery.

  8. Get better Amazon CodeWhisperer recommendations

    master

    To improve the quality and relevance of the code suggestions generated by CodeWhisperer, follow these best practices:

    • Provide context: Ensure your file contains sufficient code for the model to understand the surrounding logic.
    • Use descriptive comments: Write detailed comments (e.g., // Function to upload a file to S3) rather than vague ones (e.g., // Upload a file).
    • Specify libraries: Use explicit import statements to signal which libraries you intend to use.
    • Use descriptive naming: Use clear names for variables and functions (e.g., upload_file_to_S3 instead of file_upload).
    • Simplify tasks: Break complex logic into smaller, simpler tasks to provide clearer context.
  9. S3 Explorer terminology and definitions

    master

    When using the S3 Explorer, the following terminology is used to describe S3 resources:

    • folder: An S3 key or prefix that is treated as a directory (similar to the AWS web console).
    • object: Any file within a bucket. Each object is identified by a key, which is a combination of a prefix and a filename.
    • path: The full path to an object, represented as bucket + prefix + filename.
    • context-menu: The menu that appears when you right-click an item in the explorer.
  10. How Remote Connect works for VSCode instances

    master

    The AWS Toolkit provides 'remote connect' functionality to connect a new VSCode instance to remote machines in AWS (EC2, ECS) or CodeCatalyst.

    When connecting a new VSCode instance, the Toolkit performs the following workflow:

    1. Prerequisites: Ensures the vscode remote-ssh extension is installed.
    2. Session Manager: Automatically downloads or uses a private copy of session-manager-plugin.
    3. SSH Configuration: Updates the user's ~/.ssh/config with a special host-name pattern containing a ProxyCommand. This command invokes either codecatalyst_connect or ec2_connect.
    4. SSM Session: Starts an SSM session using the service API.
    5. Environment Setup: Launches a new VSCode instance with environment variables (like the SSM session ID) required for the connection.
    6. Connection: VSCode's remote-ssh feature uses the configured ProxyCommand and session-manager-plugin to establish the remote session.
  11. Configure debugging in launch.json

    master

    The launch.json file manages the visual running and debugging of applications.

    Workflow for debugging:

    1. Create a pre-launch task: Define a task in tasks.json responsible for building the application (e.g., npm: compile).
    2. Configure the launch setting: In launch.json, delegate the build responsibility to the pre-launch task. The launch configuration will then wait for the task to complete before attaching the debugger to the running application instance.
  12. Supported AWS credential types

    master

    The AWS Toolkit for VS Code supports the following credential types defined in shared AWS credentials files:

    • Named Profiles: Profiles containing an access key and a secret key.
    • Role Assumption: Profiles configured to assume an IAM role.
    • MFA Role Assumption: Profiles that assume a role and require multifactor authentication (MFA). The Toolkit will prompt you for the MFA token during connection.
    • External Credential Process: Profiles that use an external credential process.