website icon indicating copy to clipboard operation
website copied to clipboard

Deploy to different AWS accounts

Open nicmeriano opened this issue 3 years ago • 0 comments

I'm having problems deploying my site to different AWS accounts for staging purposes. I have two AWS accounts, one for DEV and one for PROD. My current approach to deploy to either one is by running sls deploy --stage <stage> --aws-account <account>. Each AWS account stored within .aws/credentials is pointing to the corresponding IAM user with admin access. It seems like the --aws-account flag is being ignored and the bucket is created in the account associated with the provider account linked within the Serverless dashboard.

I also tried adding a provider for each account for my app within the dashboard following https://www.serverless.com/framework/docs/guides/providers/. By doing this I'm able to deploy other components (database, api, permissions) to the right accounts but the website component keeps failing with an Access denied error.

So am I missing something? My goal is ultimately to wire this up to a CI/CD pipeline - what is the correct way to deploy to different AWS accounts/stages?

nicmeriano avatar Mar 21 '21 16:03 nicmeriano