This file contains hidden or 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
| #!/bin/bash | |
| > taskIps.env | |
| TASK_LIST=$(aws ecs list-tasks --cluster $CLUSTER_NAME) | |
| TASK_ARNS=$(echo "$TASK_LIST" | jq -r '.taskArns[]') | |
| while IFS= read -r TASK_ARN; do | |
| echo "$TASK_ARN" | |
| NETWORK_INTERFACE_ID=$(aws ecs describe-tasks --cluster $CLUSTER_NAME --tasks "$TASK_ARN" --query 'tasks[0].attachments[0].details[?name==`networkInterfaceId`].value' --output text) |
This file contains hidden or 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
| import boto3 | |
| s3 = boto3.client("s3") | |
| yes_choices = ["yes", "y"] | |
| no_choices = ["no", "n"] | |
| def delete_bucket(bucket_name): | |
| try: |
This file contains hidden or 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
| def snake_to_PascalCase(d): | |
| for k, v in d.copy().items(): | |
| if isinstance(v, dict): | |
| d.pop(k) | |
| d[k.title().replace("_", "")] = v | |
| snake_to_PascalCase(v) | |
| elif isinstance(v, list): | |
| d.pop(k) | |
| d[k.title().replace("_", "")] = v | |
| for i in v: |
This file contains hidden or 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
| def capitalize_keys(d): | |
| for k, v in d.copy().items(): | |
| if isinstance(v, dict): | |
| d.pop(k) | |
| d[f"{k[0].upper() +k[1:]}"] = v | |
| capitalize_keys(v) | |
| else: | |
| d.pop(k) | |
| d[f"{k[0].upper() +k[1:]}"] = v | |
| return d |
This file contains hidden or 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
| import boto3 | |
| from datetime import datetime, timezone | |
| s3 = boto3.client("s3") | |
| bucket = "INSERT_BUCKET_NAME" | |
| paginator = s3.get_paginator("list_objects_v2") | |
| pages = paginator.paginate(Bucket=bucket) | |
| date_check = datetime(2021, 11, 1) | |
| keys_to_delete = [] |