This pet project automates the retrieval of new AWS Managed IAM Policies to make it easier to monitor and get alerted when changes occur (by AWS) using “Watch” feature from Github or RSS.
When your app relies on AWS IAM Managed Policies (don’t do this), you will need to be notified when changes occur behind the scene. It’s also interesting to monitor new AWS services releases prior announcements :)
Releases Onlynotifications of Github
- Subscribe to the Github RSS Feed (master branch)
How it works behind the scene
These are acquired as follows:
aws iam list-policies > list-policies.json cat list-policies.json | jq -cr '.Policies | select(.Arn | contains("iam::aws"))|.Arn +" "+ .DefaultVersionId+" "+.PolicyName' | xargs -n3 sh -c 'aws iam get-policy-version --policy-arn $1 --version-id $2 > "policies/$3"' sh
This does the following:
- Gets the list of all policies in the account
- Finds the ones with an ARN containing
iam::aws, so that only the AWS managed policies are grabbed.
- Gets the ARN, current version id, and policy name (needed so we don’t have a slash as the ARN does for writing a file)
aws iam get-policy-versionwith those values, and writes the output to a file using the policy name.
- Update the EC2 system
- Install requirements:
SSH private key
- Clone the repository
- Run the magic (previous command)
- Commit changes if any
- Push (with tags for release)
- Once a day
- Migrate to Docker instead of EC2.
- Check serverless version done by RyPeck