To build a Custom Policy in code:
- Under Policies, select New Policy.
- Select the code editor option at the top of the page - [ ].
The code editor displays a basic YAML-based Policy template. You can use the template or create your Custom Policy in an external editor and paste it here when ready.
See Policy Definition Structure and Syntax and examples of Custom Policies in code.
You can check for errors in:
- Generic YAML syntax
- Policy Definition Structure
If your code includes YAML syntax errors, the first instance is indicated by an X next to the relevant row and details of the error above the editor.
change the image below
Once all YAML syntax issues are resolved, you can press Test, at the top of the page, to validate the Custom Policy.
- If the Policy is error-free, a Bridgecrew scan will be run for the Policy and the results (up to a maximum of 30) will appear on the right side of the page. This allows you to check your Custom Policy.
- If the Policy contains errors, the number of errors and their details appear above the editor.
When all errors have been corrected, you can select DONE to save your Custom policy.
Upon a successful save, the Policies grid will be displayed.
Saved custom policies can be inspected, edited or deleted from the Policies grid .
Selecting the menu at the top of the editor will give you options to:
- Format YAML - this applies indentation based on standard YAML format
- Clear Editor - to delete the code currently in the editor
Updated about 1 year ago