Skip to content

Commit

Permalink
Migrate script: Mark sandbox for cleanup
Browse files Browse the repository at this point in the history
Update todo.org file
  • Loading branch information
fridim committed Sep 21, 2023
1 parent 3e4ca26 commit bf55569
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
15 changes: 14 additions & 1 deletion todo.org
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,24 @@
* TODO patch clients (sandbox-list, mark_for_cleanup script, etc) to use the sandbox-API instead of dynamodb
* TODO documentation coverage
* TODO move handlers per version?
* DONE mark sandbox for cleanup once migrate from prod to dev
* Post MVP
** TODO unit tests and fixture/functional tests
** TODO prometheus endpoint and metrics
** TODO Encrypt IAM secret key using AWS KMS instead of ansible-vault. Use and support both while transitioning
** TODO aws lambda function to replicate changes from dynamoDB to postgresql
** TODO add POST /refresh to get new access token
** TODO Prometheus endpoint
** TODO rename env variable: prefix with DYNAMODB_ for anything related to dynamodb access

** TODO Reservations
*** DONE functional tests (hurl)
*** sandbox-api
**** DONE Update OpenAPI schema to support passing the group parameter
**** TODO patch handlers
***** TODO safeguard: do not allow reservation if capacity (after reservation) is <20%
*** TODO conan: preserve group info when cleaning up
*** TODO update AWS sandbox prometheus endpoint to show group information
*** TODO update sandbox-list: add group column
*** TODO patch legacy scripts to filter out accounts that are in a group
*** TODO expiration
**** make sure a comment is added to accounts when their expiration expires, so we can find them back.
23 changes: 23 additions & 0 deletions tools/migrate_aws_account_dynamodb_prod_to_dev.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@
}
)

# Mark new item for cleanup (dev)
response = dynamodb_dev.update_item(
TableName='accounts-dev',
Key={
'name': {
'S': sandbox
}
},
UpdateExpression="set to_cleanup = :a, #c = :c",
ExpressionAttributeNames={
'#c': 'comment'
},
ExpressionAttributeValues={
':a': {
'BOOL': True
},
':c': {
'S': 'Migrating from prod to dev'
}
},
ConditionExpression=" #c = :c",
)

except Exception as e:
print(e)
sys.exit(1)

0 comments on commit bf55569

Please sign in to comment.