serverless-components / website

:zap: Instantly deploy static website on serverless infrastructure with zero configuration using Serverless Components.
https://serverless.com
Apache License 2.0
157 stars 49 forks source link

Deploy to different AWS accounts #81

Open nicmeriano opened 3 years ago

nicmeriano commented 3 years ago

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?