You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your IAM user or IAM role has `sts:AssumeRole` permissions to a common IAM role across multiple AWS accounts, you can use the `scan-multi-account` command.
285
+
286
+
This diagram depicts how the process works:
287
+
288
+

289
+
290
+
291
+
> Note: If you are new to setting up cross-account access, check out [the official AWS Tutorial on Delegating access across AWS accounts using IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html). That can help you set up the architecture above.
292
+
293
+
294
+
* First, you'll need to create the multi-account config file. Run the following command:
295
+
296
+
```bash
297
+
cloudsplaining create-multi-account-config-file \
298
+
-o multi-account-config.yml
299
+
```
300
+
301
+
* This will generate a file called `multi-account-config.yml` with the following contents:
302
+
303
+
```yaml
304
+
accounts:
305
+
default_account: 123456789012
306
+
prod: 123456789013
307
+
test: 123456789014
308
+
```
309
+
310
+
!!! note
311
+
Observe how the format of the file above includes `account_name: accountID`. Edit the file contents to match your desired account name and account ID. Include as many account IDs as you like.
312
+
313
+
314
+
For the next step, let's say that:
315
+
* We have a role in the target accounts that is called `CommonSecurityRole`.
316
+
* The credentials for your IAM user are under the AWS Credentials profile called `scanning-user`.
317
+
* That user has `sts:AssumeRole` permissions to assume the `CommonSecurityRole` in all your target accounts specified in the YAML file we created previously.
318
+
* You want to save the output to an S3 bucket called `my-results-bucket`
319
+
320
+
Using the data above, you can run the following command:
321
+
322
+
```bash
323
+
cloudsplaining scan-multi-account \
324
+
-c multi-account-config.yml \
325
+
--profile scanning-user \
326
+
--role-name CommonSecurityRole \
327
+
--output-bucket my-results-bucket
328
+
```
329
+
330
+
> Note that if you run the above without the `--profile` flag, it will execute in the standard [AWS Credentials order of precedence](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default) (i.e., Environment variables, credentials profiles, ECS container credentials, then finally EC2 Instance Profile credentials).
331
+
282
332
283
333
## Cheatsheet
284
334
@@ -316,7 +366,7 @@ This is likely an issue with your PATH. Your PATH environment variable is not co
316
366
export PATH=$HOME/Library/Python/3.7/bin/:$PATH
317
367
```
318
368
319
-
**I followed the installation instructions but I am receiving a `ModuleNotFoundError` that says `No module named policy_sentry.analysis.expand`. What should I do?**
369
+
**I followed the installation instructions, but I am receiving a `ModuleNotFoundError` that says `No module named policy_sentry.analysis.expand`. What should I do?**
320
370
321
371
Try upgrading to the latest version of Cloudsplaining. This error was fixed in version 0.0.10.
0 commit comments