cfn-permission-checker
is a command-line tool that extracts CloudFormation events from CloudTrail logs to verify the permissions required for deployment.
- Extract and analyze CloudFormation deployment events from CloudTrail logs
- Filter events by time range
- Display specific properties of events
- Help troubleshoot permission issues and audit CloudFormation deployments
To display events from 2 hours ago:
cfn-permission-checker filter --from '2h'
To display specific properties of events:
cfn-permission-checker filter --from '2h' -p 'requestParameters'
- AWS SAM CLI - Required to deploy the CloudTrail stack
- Rye - Package manager for Python projects
To enable CloudTrail, you need to deploy an AWS SAM stack. Please refer to the official AWS SAM CLI documentation for installation instructions.
cd sam
make
Install Rye by following the official Rye installation guide.
Once Rye is installed, you can install cfn-permission-checker
using the following command:
rye tools install --git 'https://github.com/ajisaka/cfn-permission-checker#subdirectory=app/' cfn-permission-checker
This will install the cfn-permission-checker
command-line tool.
Here are some additional examples of how to use cfn-permission-checker:
# Filter events from the last 24 hours
cfn-permission-checker filter --from '24h'
# Display only the 'eventName' and 'userIdentity' properties
cfn-permission-checker filter --from '1d' -p 'eventName' -p 'userIdentity'
# Save output to a JSON file
cfn-permission-checker filter --from '1w' > cfn_events.json
If you encounter any issues during installation or usage, please check the following:
- Ensure you have the latest versions of AWS SAM CLI and Rye installed.
- Verify that your AWS credentials are properly configured.
- Check the CloudTrail logs to ensure events are being recorded correctly.
For more detailed information, please refer to the project's GitHub repository or open an issue if you encounter any problems.