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 | |
import time | |
import json | |
import uuid | |
propert_alias_list = [ | |
'Test_Asset_01/Crest', | |
'Test_Asset_01/Fatigue_inps', | |
'Test_Asset_01/Fatigue_mmps', | |
'Test_Asset_01/Fatigue_mps', |
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 | |
import os | |
bucket_name = '<bucket-name>' | |
s3_prefix = '<prefix>' | |
s3_resource = boto3.resource('s3') | |
bucket = s3_resource.Bucket(bucket_name) | |
for obj in bucket.objects.filter(Prefix = s3_prefix): | |
if not os.path.exists(os.path.dirname(obj.key)): |
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 | |
boto3.setup_default_session(profile_name='awsiot') | |
client = boto3.client('iot') | |
list_certificates_paginator = client.get_paginator('list_certificates') | |
list_certificates_pages = list_certificates_paginator.paginate() | |
for list_certificates in list_certificates_pages: | |
for certificate in list_certificates["certificates"]: |
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 | |
now=$(date +%d%m%Y-%H.%M.%S) | |
filename=db.sqlite3.$now.zip | |
zip /home/ubuntu/backup-s3/$filename /home/ubuntu/django-prod/db.sqlite3 | |
aws s3 mv /home/ubuntu/backup-s3/$filename s3://django-db-backups | |
rm /home/ubuntu/backup-s3/$filename |