I have a need to provision resources in multiple a...
# aws
r
I have a need to provision resources in multiple aws accounts. How do we do this in pulumi? Any examples?
b
you can set providers on resources, and inside that provider you can specify the AWS account. I don't think we have an example to hand, but you can see examples of using a provider here: https://github.com/pulumi/examples/search?q=aws.Provider
r
Thanks @billowy-army-68599. Will take a look.
t
@ripe-shampoo-80285 Something like this:
Copy code
new aws.Provider('CI Provider', {
    region: aws.Region.EUNorth1,
    assumeRole: {
        roleArn: pulumi.interpolate`arn:aws:iam::${stack.getOutput('ci_account').apply(output => output.id)}:role/OrganizationAccountAccessRole`
    }
});
Where the
ci_account
bit is your account ID from AWS
Then you can use that provider line like this:
Copy code
new aws.ec2.Vpc("Jobilla Network", {
    cidrBlock: "10.0.0.0/16",
    enableDnsSupport: true,
    enableDnsHostnames: true,
}, {
    provider: provider,
});
Where
provider
is the provider above
r
Thanks @tall-beard-99429!
t
no problem, let me know if you need a hand, its something i've done recently