Infrastructure > AWS
Use AWS Profiles
How to deploy your Webiny project using different AWS profiles.
- how to deploy your Webiny project using different AWS profiles
AWS Profiles
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.
How to Use
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
The easiest way to do it would be using the .env
file, located in your project root, for example:
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
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
command:
On Windows, you can utilize the set
and setx
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
Is There a Way to Check if My Profile Was Set Properly?
If you have the AWS CLI installed on your system, in your terminal, you can run the following command:
This should give an output similar to the following: