Skip to content

Instantly share code, notes, and snippets.

@gneatfosacho
Created November 3, 2021 20:49
Show Gist options
  • Select an option

  • Save gneatfosacho/2272ef24b64bde757fa82f8ab032686f to your computer and use it in GitHub Desktop.

Select an option

Save gneatfosacho/2272ef24b64bde757fa82f8ab032686f to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates AWS Data Pipeline from Pacman's MySQL to S3
Resources:
PacmanMySQLInputS3OutputCFN2:
Type: AWS::DataPipeline::Pipeline
Properties:
Name: PacmanMySQLInputS3OutputCFN2
Description: "Data Pipeline from Pacman's MySQL to S3"
Activate: true
PipelineObjects:
- Id: "S3OutputLocation"
Name: "Copy data to this S3 location"
Fields:
- Key: "type"
StringValue: "S3DataNode"
- Key: "directoryPath"
StringValue: "s3://xxxxx/#{format(@scheduledStartTime, 'YYYY-MM-dd-HH-mm-ss')}"
- Id: "PacmanRDSMySQL"
Name: "Pacman RDS MySQl details"
Fields:
- Key: "type"
StringValue: "RdsDatabase"
- Key: "rdsInstanceId"
StringValue: "xxxx"
- Key: "databaseName"
StringValue: "xxxx"
- Key: "username"
StringValue: "xxxx"
- Key: "*password"
StringValue: "xxxx"
- Key: "jdbcProperties"
StringValue: "allowMultiQueries=true"
- Id: "SourceRDSTable"
Name: "Pacman RDS MySQL Db's Table details"
Fields:
- Key: "type"
StringValue: "SqlDataNode"
- Key: "database"
RefValue: "PacmanRDSMySQL"
- Key: "table"
StringValue: "user_profile"
- Key: "selectQuery"
StringValue: "select * from #{table} where LAST_UPDATED_DATE >= '#{format(@scheduledStartTime, 'YYYY-MM-dd HH:mm:ss')}' and LAST_UPDATED_DATE <= '#{format(@scheduledEndTime, 'YYYY-MM-dd HH:mm:ss')}"
- Id: "PacmanRDStoS3CopyActivity"
Name: "Pacman RDS MySQL to S3 Copy Activity"
Fields:
- Key: "type"
StringValue: "CopyActivity"
- Key: "input"
RefValue: "SourceRDSTable"
- Key: "runsOn"
RefValue: "Ec2InstanceForActivity"
- Key: "output"
RefValue: "S3OutputLocation"
- Id: "Ec2InstanceForActivity"
Name: "Ec2 Instance for performing Copy Activity"
Fields:
- Key: "type"
StringValue: "Ec2Resource"
- Key: "instanceType"
StringValue: "t1.micro"
- Key: "terminateAfter"
StringValue: "1 Hours"
- Key: "actionOnTaskFailure"
StringValue: "terminate"
- Key: "subnetId"
StringValue: "subnet-xxxx"
- Key: "securityGroupIds"
StringValue: "sg-xxxx"
- Id: "EveryOneDaySchedule"
Name: "Every 1 day schedule"
Fields:
- Key: "type"
StringValue: "schedule"
- Key: "startAt"
StringValue: "FIRST_ACTIVATION_DATE_TIME"
- Key: "period"
StringValue: "1 Day"
- Id: "Default"
Name: "Default"
Fields:
- Key: "type"
StringValue: "Default"
- Key: "scheduleType"
StringValue: "cron"
- Key: "failureAndRerunMode"
StringValue: "CASCADE"
- Key: "role"
StringValue: "PacmanUserProfileDataPipelineRole"
- Key: "resourceRole"
StringValue: "PacmanUserProfileDataPipelineResourceRole"
- Key: "pipelineLogUri"
StringValue: "s3://xxxxx/"
- Key: "schedule"
RefValue: "EveryOneDaySchedule"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment