Module 5: Missing s3 Configuration
In this module, as part of security governance, all s3 buckets must have s3 versioning configuration enabled. This policy helps organizations recover from deletion or alterations of data by keeping copies of previous versions. As a security engineer, you want to enable the pipeline to enforce enabling s3 bucket versioning configuration.
Setting Lambda to scan AWS Cloudformation templates for s3 configuration settings
- Browse to the Lambda console, and create a new function from scratch.
- Be sure to select the Python 2.7 runtime, and the module*PipelineLambdaRole-
- Name the function to your choosing. Create function.
- Set the Lambda time out to 1 minute.
cfn_s3_versioning.pyis provided in the workshop. Open this in your favorite editor.
- Paste the contents of
cfn_s3_versioning.pysource editor (the one in the Lambda console), overwriting the initial placeholder function.
- Browse back to the CodePipeline Console, and open your DevSecOps Pipeline again.
- Edit the pipeline, using the button at the top right.
- Use the
Edit Stagebutton for the StaticCodeAnalysis stage.
- Select the Edit icon for the CFNParsing function.
- Copy the contents of “User Parameters (optional)” to your paste buffer. Close the Edit action pop-up.
- Add a new action group.
- Select “Add action group”.
- Create a name for your key-scanning action, choose AWS Lambda from the Action provider drop-down.
- In “Function name”, select the name you gave your Lambda function in Step 2 above.
- TemplateSource in the “Input artifacts” drop-down.
- Paste the contents of your paste buffer from above into “User Parameters (optional)”
- Select Save the newly-edited pipeline. You must check the “No resource updates needed for this source action change” option on the pipeline save pop-up window.
- Your new Lambda function is now integrated into your pipeline.
Proceed to the next module to test your Lambda function.
What other things can you look for in an AWS Cloudformation template which you can create a security automation?