I use different profiles for multiple aliases, and/or I use a different profile for my backend configuration.
AWS profiles are typically used when executing your code locally, because you can manage multiple credentials for different AWS accounts in your .AWS/credentials file.
When using env0 to run the same code, you will need to setup a similar ~/.aws/credentials file so that Terraform or Terragrunt can find the profile credentials to access your AWS account.
How to setup a AWS credentials
We recommend using the env0.yaml (Custom Flow feature) to help prepare the credentials file. One easy way is to have a copy of your credential file in an S3 bucket, and use the custom flow to copy the credential file into the home directory of the runner.
- mkdir ~/.aws
- aws s3 cp s3://mybucket/credentials ~/.aws/credential
Consider using AWS assume roles in your profile configuration so you don't use static credentials. See our docs on setting up assume roles for more information. https://docs.env0.com/docs/connect-your-cloud-account#using-aws-assume-role