What you’ll learn
  • how to deploy your Webiny project using different AWS profiles

AWS Profiles
anchor

AWS profiles enable you to store multiple AWS credentials on your system, and then, when the time comes, to use specific credentials in order to perform a command against the AWS cloud.

Read more about profiles and how to set them up in the official AWS documentation articleexternal link.

How to Use
anchor

While executing deployment-related commands via the Webiny CLI, for example deploy or destroy, if not specified, Webiny will always use the default AWS profile.

A different profile can be specified via the AWS_PROFILE environment variable, which you can set in a couple of ways.

Using.envFile
anchor

The easiest way to do it would be using the .env file, located in your project root, for example:

.env

The advantage of this approach is that you don’t need to set the AWS_PROFILE via your terminal, but it always stays in the .env file, which is automatically loaded when executing mentioned deployment-related commands.

Using Terminal
anchor

Apart from setting it via the shown .env file, the AWS_PROFILE environment variable can also be set using a terminal of your choice, and a command that’s available on your operating system.

For example, on Linux or MacOS, you can use the exportexternal link command:

On Windows, you can utilize the setexternal link and setxexternal link commands, for example:

Once the AWS_PROFILE has been properly set via one of the shown methods, you can proceed with the deployment of your Webiny project.

FAQ
anchor

Is There a Way to Check if My Profile Was Set Properly?
anchor

If you have the AWS CLIexternal link installed on your system, in your terminal, you can run the following command:

This should give an output similar to the following: