By default, when you use the /dev
command, Amazon Q does not automatically test
the code that it presents to you in the chat. You need to save the code and then test it separately.
Amazon Q can’t test its code because it lacks an environment with the tools necessary to complete the
work.
To enable Amazon Q to test its code, you must allow it to launch a dev environment by providing it with a devfile.
Note
For more information about the /dev
command and the Amazon Q Developer Agent for software development,
see Developing features with Amazon Q Developer.
What is a dev environment?
A dev environment is a Docker container
Amazon Q launches the Docker container in a sandbox, meaning the container is isolated from AWS services to protect them from problematic code that Amazon Q might generate.
What is a devfile?
A devfile is a YAML file that complies with the devfile specification
A devfile describes:
-
The name and location of Docker container image to be used as the dev environment.
-
The commands to run automatically when the dev environment is launched.
A devfile can contain other types of information, but the two mentioned previously are the ones relevant to Amazon Q.
You can provide your own devfile, or you can let Amazon Q generate one for you.
How it works
Whenever you enter the /dev
command into the Amazon Q chat panel, Amazon Q looks
for a devfile in the root of your project.
If a devfile exists, Amazon Q:
-
Launches a dev environment in a sandbox, in AWS.
-
Generates a code suggestion (but doesn't present it to you yet).
-
Builds and tests the suggestion in the dev environment using the instructions in the devfile.
-
Iterates on the suggestion if the tests aren’t passing. Amazon Q conducts three iterations, and this is not configurable.
-
Presents the tested code in the chat window.
-
Terminates the dev environment.
If a devfile doesn’t exist, Amazon Q asks you whether you want to generate one. If you say yes, Amazon Q
generates a devfile based on the context of your project. For more information about what this
devfile might look like, see Example devfiles in Amazon Q Developer.
After generating the devfile, Amazon Q does not start using it. You’ll need to enter another
/dev
command to invoke the devfile.
Sandbox specifications
The sandbox in which a dev environment is launched has 2 vCPUs and 4 GB of memory. The CPU and memory are not configurable.
Amazon VPC support
Amazon Q doesn't support running dev environments within your Amazon Virtual Private Cloud (Amazon VPC). For more information about Amazon VPC, see What is Amazon VPC? in the Amazon Virtual Private Cloud User Guide.