does anyone know how to deploy two stacks of the s...
# general
r
does anyone know how to deploy two stacks of the same project in two diff aws accounts?
w
Two thoughts: 1. The general idea would be to swap out the AWS credentials. The AWS Provider docs indicate env vars have higher precedence than config, so by changing your creds in the environment, you can point Pulumi to a different AWS account. 2. But your state won't be in sync! It depends on your backend. If you're using filestate, then you can store your state for your second account in a separate file. Same with S3 -- you can use a separate S3 bucket on your second AWS account to store state. If you're using the Service backend, I'm not sure how you'd do this (see the comment below about alternatives). In general, instead of deploying the same stack twice, I'd recommend using a different stack for each instance of your environment. That way, the stack config can determine which AWS account you're pointing to. For example, suppose you have stacks
my-toy-aws-account
and
my-real-aws-account
. You can set your AWS config in
Pulumi.my-toy-aws-account.yaml
to point to your first AWS account and
Pulumi.my-real-aws-account.yaml
to point to your second account. If the rest of your config is the same, you'll have the same effect as if you had used one stack and swapped the credentials. This approach will also work with the Pulumi Service backend. Someone else can correct me if I'm wrong, but I suspect having one stack per environment is "idiomatic Pulumi". Of course, your needs may preclude that 🙂
r
can we do the
aws:profile
param in the config
r
thank you!