Skip to content

Instantly share code, notes, and snippets.

@sandeepmanchi
sandeepmanchi / extract-email-attachment.py
Last active March 12, 2024 14:19
Python code to extract email attachment from raw email message stored in S3
import json
import boto3
import email
import os
from datetime import datetime
import re
def get_timestamp():
current = datetime.now()
return(str(current.year) + '-' + str(current.month) + '-' + str(current.day) + '-' + str(current.hour) + '-' + str(current.minute) + '-' + str(current.second))
@sandeepmanchi
sandeepmanchi / source-account-role.txt
Last active September 3, 2021 03:37
source-account-role-list-replicated-buckets
{
2 "Version": "2012-10-17",
3 "Statement": [
4 {
5 "Sid": "GetSourceBucketConfiguration",
6 "Effect": "Allow",
7 "Action": [
8 "s3:ListBucket",
9 "s3:GetBucketLocation",
10 "s3:GetBucketAcl",
@sandeepmanchi
sandeepmanchi / bucket-policy-on-destination-bucket-1.txt
Last active June 2, 2023 12:29
bucket-policy-on-destination-bucket-1
{
2 "Version": "2012-10-17",
3 "Id": "PolicyForDestinationBucket",
4 "Statement": [
5 {
6 "Sid": "Permissions on objects and buckets",
7 "Effect": "Allow",
8 "Principal": {
9 "AWS": "arn:aws:iam::999999999999:role/cross-account-bucket-replication-role"
10 },
{
2 "Version": "2012-10-17",
3 "Id": "PolicyForDestinationBucket",
4 "Statement": [
5 {
6 "Sid": "Permissions on objects and buckets",
7 "Effect": "Allow",
8 "Principal": {
9 "AWS": "arn:aws:iam::999999999999:role/cross-account-bucket-replication-role"
10 },