This solution sets up a small service that collects the high-level AWS Well-Architected review data for a given workload. It's currently for a single account, so you'd either need to modify this, or deploy this utility to each account you want to collect reviews from.
It's a convenient solution if you want, for example, to display the number of risks for a workload in your own dashboards or systems monitoring tool.
You could easily extend this solution with additional functionality; see the AWS docs on the WA tool for what is possible.
- Recent Node.js (ideally 18+) installed.
- Amazon Web Services (AWS) account with sufficient permissions so that you can deploy infrastructure.
- Ideally some experience with Serverless Framework as that's what we will use to deploy the service and infrastructure.
- You will need to set up a workload in the AWS Well-Architected Tool manually, as that's not part of this solution.
Clone, fork, or download the repo as you normally would. Run npm install
.
The below commands are the most critical ones. See package.json
for more commands! Substitute npm
for yarn
or whatever floats your boat.
npm start
: Run Serverless Framework in offline modenpm run deploy
: Deploy with Serverless Frameworknpm run build
: Package and build the code with Serverless Frameworknpm run teardown
: Removes the deployed stack
You need to set your AWS account number. Do this either by passing it in via CLI, e.g. npx sls deploy --account 123412341234
or setting the fallback value in serverless.yml
:
awsAccountNumber: ${opt:account, '123412341234'}
The request requires the workload ID to be passed in.
Note that you might need to switch on the ID column if using the web console/UI as it's not visible by default.
curl https://RANDOM.execute-api.REGION.amazonaws.com/reviews?id=WORKLOAD_ID
[
{
"LensAlias": "arn:aws:wellarchitected:eu-north-1:123412341234:lens/abcdef123456abcdef123456abcdef12",
"LensArn": "arn:aws:wellarchitected:eu-north-1:123412341234:lens/abcdef123456abcdef123456abcdef12",
"LensName": "My Custom Lens",
"LensStatus": "CURRENT",
"LensVersion": "0.1",
"RiskCounts": { "UNANSWERED": 0, "HIGH": 7, "MEDIUM": 8, "NONE": 21, "NOT_APPLICABLE": 13 },
"UpdatedAt": "2023-05-18T07:13:14.000Z"
},
{
"LensAlias": "wellarchitected",
"LensArn": "arn:aws:wellarchitected::aws:lens/wellarchitected",
"LensName": "AWS Well-Architected Framework",
"LensStatus": "CURRENT",
"LensVersion": "2023-04-10",
"RiskCounts": { "UNANSWERED": 0, "HIGH": 43, "MEDIUM": 4, "NONE": 1, "NOT_APPLICABLE": 12 },
"UpdatedAt": "2023-05-18T07:17:46.000Z"
}
]