Skip to content

Instantly share code, notes, and snippets.

@maddydevs
maddydevs / delete_all_object_versions.sh
Created December 28, 2021 09:49 — forked from pecigonzalo/delete_all_object_versions.sh
Delete all versions (except latest) of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions | .[] | select(.IsLatest | not)'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@maddydevs
maddydevs / generate_cloudfront_signed_cookies.py
Created October 20, 2021 11:37 — forked from mjohnsullivan/generate_cloudfront_signed_cookies.py
Python script that generates signed cookies to control access to CloudFront content
#!/usr/bin/env python
"""
Copyright (C) 2017 Matt Sullivan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@maddydevs
maddydevs / UploadToAmazonGlacier.py
Created September 24, 2021 08:29 — forked from epjuan21/UploadToAmazonGlacier.py
Subir archivo a Amazon Glacier con Python y Boto3
import logging
import boto3
from botocore.exceptions import ClientError
def upload_archive(vault_name, src_data):
"""Agrega un archivo a una bodega de Amazon Glacier .
La carga se produce de forma sincrónica.
:param vault_name: string
@maddydevs
maddydevs / aws-glacier-upload.py
Created September 24, 2021 08:29 — forked from gauthamp10/aws-glacier-upload.py
Upload files (upto 4Gb) to AWS S3 Glacier
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied. See the License for the specific
@maddydevs
maddydevs / RetrieveInventoryResult.py
Created September 24, 2021 08:28 — forked from epjuan21/RetrieveInventoryResult.py
Solicitar Inventario en Amazon Glacier con Python y Boto3
import json
import logging
import boto3
from botocore.exceptions import ClientError
def retrieve_inventory_results(vault_name, job_id):
"""Retrieve the results of an Amazon Glacier inventory-retrieval job
:param vault_name: string
:param job_id: string. The job ID was returned by Glacier.Client.initiate_job()