Serverless app designed for any customer with two or more accounts to view resources/tags across accounts/regions in simple single pane of glass website. It's split into 2 customizable parts:
Back-End (CloudFormation templates and Python Lambdas)
Administrator account is the account you will use to access all sub accounts and where you will store everything. SubAccounts only requires the SubAccountAccess template to be created.
Clone repo.
Run CloudFormation template in your sub accounts (SubAccountAccess.yaml).
Run CloudFormation template in your main account (MainTemplate.yaml).
Run React App.
Deploying the Solution
Sub Accounts
Note the Account number for your Administrator Account and put it into the SubAccountAccess template.
Edit the SubAccountAccess.yaml with your Administrator Account Number (this account number will be your Administrator account that will have access to view all the sub accounts from)
Save and Run the SubAccountAccess.yaml in all your sub accounts you want to view. (I recommend using StackSets if you have them enabled otherwise manual is fine)
Administrator Account
Create a new S3 bucket to store the lambda zip files
Everyone's accounts and regions vary so this example is set to the free tier for DynamoDB AutoScaling is configured for DynamoDB so it will between the 2 parameters you specifiy.
Update all the parameters to match your config/accounts/bucket in MainTemplate.yaml
Deploy the CloudFormation template in the admin account once you have updated the paramaters
Once the CloudFormation has completed copy the details in the outputs:
ApiGateWayEndPoint
UserPoolId
userPoolWebClientId
Paste the outputs into Front-End/.env, or directly into Front-End/src/App.js:
Create a user account for the Cognito User Pool (sign up is disabled, so users have to be created manually)
Cognito > User Pools > {YourStackName} > Users and groups > Create User.
Now navigate to Front-End and Install dependencies
cd /aws-multi-account-viewer/Front-End/
yarn
Start React Page
yarn start
You should now see a login page from React
Log in with the user you created earlier.
You now have a local version up and running, you could now safely host as a public s3 bucket. (not covered in this project but you can see examples online on how to set it up: S3-Public-Website)
A really good article on setting React up with S3 by Antoine Sauvage: Here
Adding New Services
To add a new services, see example for this git commit:
Example of adding a new service EKS here EKS
Troubleshooting
No data is being populated on the web site?
Check SQS to make sure the messages are going through to lambda
If there’s lots of messages in the queue then there’s an issue with the lambda or DynamoDB is throttling the requests.
Site breaks when hosted on s3?
There's a good guide above on how to host React on S3, most common gotcha is error document:
Lambda Logs Overview?
You can check all three lambdas logs easy in CloudWatch Insights:
Lambda Logs Error & Exceptions:
Copy and paste query below to only see Errors & Exceptions: (this example is showing throttle requests on DynamoDB because its set too low):
fields @message
| filter @message like /Error/ or @message like /Exception/
| limit 50
Tables are empty?
Check SQS queue to see what services are failing
View CloudWatch Logs above across receive/send lambda's to see where the issue is.