Warning
You're browsing the documentation for an old version of Webiny. Consider upgrading your project to Webiny 5.34.x.
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 article external 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 .env File
anchor

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

.env
AWS_PROFILE=my-profile

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 export external link command:

export AWS_PROFILE=my-profile

On Windows, you can utilize the set external link and setx external link commands, for example:

setx AWS_PROFILE my-profile

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 CLI external link installed on your system, in your terminal, you can run the following command:

aws sts get-caller-identity

This should give an output similar to the following:

{
    "Account": "x",
    "UserId": "y",
    "Arn": "arn:aws:iam::x:user/z"
}