-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove resource bucket as we use a workshop static url for the lambda package * update readme * update readme * change the sequence for the shell to avoid errors if CFN fails * check if bucket exists and permission with boto 3 * remove unused import * fix support case partitioning * add a convenient script to package lambda * add changelog * update gitignore * fix import and timezone warning * update lambda collector version * update formatting of the deployment script * Change the way the data is partitioned in S3 to avoid duplicates * update changelog * fix pylint warning * update instructions
- Loading branch information
1 parent
ed611a0
commit e548498
Showing
11 changed files
with
97 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changelog | ||
|
||
## Support Collector Lambda v1.0.1 | ||
|
||
* Partition support cases and Health data using their creation date in S3 (YYYY/MM) to avoid saving duplicates on the daily sync | ||
* Flatten Trusted Advisor checks in S3 to avoid duplicates during daily sync. | ||
|
||
## Support Collector Lambda v1.0.0 | ||
|
||
* Update to Python 3.11 runtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
#!/bin/bash | ||
echo "This script will deploy the solution to an organization.\n" | ||
printf "This script will deploy the solution to an organization.\n\n" | ||
|
||
echo "Enter the OU IDs separated by commas (ie: ou-xxxxxxxxxx1,ou-xxxxxxxxxx2): " | ||
printf "Enter the OU IDs separated by commas (ie: ou-xxxxxxxxxx1,ou-xxxxxxxxxx2): " | ||
read OU_IDS | ||
echo "" | ||
printf "\n\n" | ||
|
||
echo "Enter the data collection S3 bucket name in the management account: " | ||
printf "Enter the data collection S3 bucket name in the management account: " | ||
read DATA_BUCKET_NAME | ||
echo "" | ||
printf "\n\n" | ||
|
||
echo "Do you want the script to overwrite the data collection bucket policy on your behalf?\nThis requires PutBucketPolicy permission and it will OVERWRITE the current policy.\nIf the policy is not set, member accounts may not be able to store their data properly. (Y/N, default: Y): " | ||
printf "Do you want the script to overwrite the data collection bucket policy on your behalf?\nThis requires PutBucketPolicy permission and it will OVERWRITE the current policy.\nIf the policy is not set, member accounts may not be able to store their data properly. (Y/N, default: Y): " | ||
read OVERWRITE_DATA_BUCKET_POLICY_ANSWER | ||
if [ "$OVERWRITE_DATA_BUCKET_POLICY_ANSWER" != "${OVERWRITE_DATA_BUCKET_POLICY_ANSWER#[Yy]}" ] ;then | ||
if [ "$OVERWRITE_DATA_BUCKET_POLICY_ANSWER" != "${OVERWRITE_DATA_BUCKET_POLICY_ANSWER#[Yy]}" ] ;then | ||
OVERWRITE_DATA_BUCKET_POLICY=--overwrite-data-bucket-policy | ||
else | ||
OVERWRITE_DATA_BUCKET_POLICY="--no-overwrite-data-bucket-policy" | ||
fi | ||
echo "" | ||
printf "\n\n" | ||
|
||
echo "Invoking deploy_infrastructure.py..." | ||
printf "Invoking deploy_infrastructure.py...\n" | ||
python3 deploy_infrastructure.py --data-bucket "${DATA_BUCKET_NAME}" --ou-ids "${OU_IDS}" "${OVERWRITE_DATA_BUCKET_POLICY}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
echo "Cleaning up old files..." | ||
rm -rf support-collector-lambda.zip support-collector-lambda-layer.zip python temp_dir | ||
|
||
echo "Installing dependencies into a temporary directory..." | ||
mkdir temp_dir | ||
pip3 install -r requirements.txt -t temp_dir/ | ||
|
||
echo "Copying dependencies to the Lambda directory..." | ||
cp -r temp_dir/* support-collector-lambda/ | ||
|
||
echo "Creating deployment package..." | ||
cd support-collector-lambda | ||
zip -r ../support-collector-lambda.zip . -x '*.DS_Store' 2>/dev/null || true | ||
cd .. |
3 changes: 0 additions & 3 deletions
3
src/support_collector/support-collector-lambda/lambda_function.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from datetime import datetime | ||
|
||
|
||
def convert_time_to_month_year(iso_datetime): | ||
# Parse the time_created string into a datetime object | ||
# dt = datetime.strptime(iso_datetime, "%Y-%m-%dT%H:%M:%S.%fZ") | ||
iso_date = iso_datetime.replace("Z", "+00:00") | ||
dt = datetime.fromisoformat(iso_date) | ||
|
||
# Extract the year and month components | ||
year = dt.year | ||
month = dt.month | ||
|
||
# Format the year and month as "YYYY/MM" | ||
month_year = f"{year}/{month:02d}" | ||
|
||
return month_year |