Skip to content

Instantly share code, notes, and snippets.

@iamatypeofwalrus
Created November 10, 2017 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamatypeofwalrus/b3b9084e8ea242b6becbaa875ace3165 to your computer and use it in GitHub Desktop.
Save iamatypeofwalrus/b3b9084e8ea242b6becbaa875ace3165 to your computer and use it in GitHub Desktop.
DynamoDB backup Common
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Common resources for DynamoDB backups'
Resources:
DynamoDBBackupsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName:
Fn::Join:
- "-"
- - dynamodb
- backups
- Ref: AWS::AccountId
- Ref: AWS::Region
DataPipelinesBackupRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: DataPipelinesBackupRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSDataPipelineRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
- "elasticmapreduce.amazonaws.com"
- "datapipeline.amazonaws.com"
Action:
- "sts:AssumeRole"
EC2BackupRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: EC2BackupRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforDataPipelineRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
- "ec2.amazonaws.com"
- "elasticmapreduce.amazonaws.com"
- "datapipeline.amazonaws.com"
Action:
- "sts:AssumeRole"
EC2BackupRoleInstanceProfile:
Type: "AWS::IAM::InstanceProfile"
Properties:
Roles:
- Ref: EC2BackupRole
BackupSuccessTopic:
Type: "AWS::SNS::Topic"
Properties:
TopicName:
Fn::Join:
- "-"
- - Ref: TableName
- "backup"
- "success"
BackupFailureTopic:
Type: "AWS::SNS::Topic"
Properties:
TopicName:
Fn::Join:
- "-"
- - Ref: TableName
- "backup"
- "failure"
# # Lambda
# ConversionInvoker:
# # Glue
# BackupToParquetConversionJob:
# ParquetCrawer:
Outputs:
DynamoDBBackupsBucket:
Description: "S3 bucket for DynamoDB Backups"
Value:
Ref: DynamoDBBackupsBucket
Export:
Name: "dynamodb-backup-s3-bucket"
DataPipelinesBackupRole:
Description: "IAM Role for Data Pipelines"
Value:
Ref: DataPipelinesBackupRole
Export:
Name: "dynamodb-backup-data-pipelines-role"
EC2BackupRoleInstanceProfile:
Description: "IAM Instance Profile for the EC2 Backup Role"
Value:
Ref: EC2BackupRoleInstanceProfile
Export:
Name: "dynamodb-backup-ec2-instance-profile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment