These notes are intended to help RDK developers update the repository consistently.
These instructions document the parts of the repository that need to be updated when support for a new Lambda runtime is added.
- Add to
classifiers
list:
"Programming Language :: Python :: <VER>,"
- Add to
include
list:
"rdk/template/runtime/python<VER>/*",
"rdk/template/runtime/python<VER>-lib/*",
- Update documentation and examples
- Update references to include new version
- Add new test cases for the new version
To release a new version of RDK...
- Update
pyproject.toml
with the new version number - Update
rdk/__init__.py
with the new version number - Locally
git pull origin master
to ensure you have the latest code - Locally
git tag <new version number> && git push origin <new version number>
to create a tagged version, which will kick off the remaining workflows.
- Clone the RDK repo from git
- Make your changes
poetry build
# builds a wheel package inside of the dist folderpip install --force-reinstall <path to your .whl file>
# optionally, use--user
to install for just the current user.
Note: before running these, make sure to set your AWS credentials and region appropriately.
These are not a replacement for unit tests, but because RDK inherently relies on CloudFormation, some level of end-to-end testing is necessary.
- Basic periodic custom rule creation and deployment
$rule="myAutomationTest" # This is gitignored
$runtime="python3.12"
$frequency="TwentyFour_Hours"
rdk create $rule --runtime $runtime --maximum-frequency $frequency
rdk deploy $rule
# It should deploy a CloudFormation stack successfully.
rdk undeploy $rule --force
Remove-Item $rule -recurse
- Basic configuration-change custom rule creation and deployment
$rule="myAutomationTest" # This is gitignored
$runtime="python3.12"
$test_event_type = "AWS::EC2::Instance"
rdk create $rule --runtime $runtime --resource-types $test_event_type
rdk deploy $rule
# It should deploy a CloudFormation stack successfully.
rdk undeploy $rule --force
Remove-Item $rule -recurse
- Managed rule creation and deployment
$rule="myAutomationTest" # This is gitignored
$managed_rule="ACCESS_KEYS_ROTATED"
$frequency="TwentyFour_Hours"
rdk create $rule --source-identifier $managed_rule --maximum-frequency $frequency
rdk deploy $rule
# It should deploy a CloudFormation stack successfully.
rdk undeploy $rule --force
Remove-Item $rule -recurse
- Deploy a proactive rule
$rule="myAutomationTest" # This is gitignored
$runtime="python3.12"
$test_event_type = "AWS::S3::Bucket"
$evaluation_mode="PROACTIVE"
rdk create $rule --runtime $runtime --evaluation-mode $evaluation_mode --resource-types $test_event_type
rdk deploy $rule
# It should deploy a CloudFormation stack successfully.
rdk undeploy $rule --force
Remove-Item $rule -recurse # clean up the directory for future testing
- Deploy a proactive rule as a periodic rule (should fail)
$rule="myAutomationTest" # This is gitignored
$runtime="python3.12"
$evaluation_mode="BOTH"
$frequency="TwentyFour_Hours"
rdk create $rule --runtime $runtime --evaluation-mode $evaluation_mode --maximum-frequency $frequency
# It should fail at create time
- Deploy a proactive managed rule
$rule="myAutomationTest" # This is gitignored
$managed_rule="S3_BUCKET_LOGGING_ENABLED"
$evaluation_mode="BOTH"
$test_event_type = "AWS::S3::Bucket"
rdk create $rule --source-identifier $managed_rule --resource-types $test_event_type --evaluation-mode $evaluation_mode
rdk deploy $rule
# It should deploy a CloudFormation stack successfully.
rdk undeploy $rule --force
Remove-Item $rule -recurse
- Deploy a proactive managed Organization rule
$rule="myAutomationTest" # This is gitignored
$managed_rule="S3_BUCKET_LOGGING_ENABLED"
$evaluation_mode="PROACTIVE"
$test_event_type = "AWS::S3::Bucket"
$test_management_account = "730335412016"
rdk create $rule --source-identifier $managed_rule --resource-types $test_event_type --evaluation-mode $evaluation_mode
rdk deploy-organization $rule --excluded-accounts $test_management_account
# It should fail to deploy due to an unsupported evaluation mode.
Remove-Item $rule -recurse