Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 3 KB

File metadata and controls

59 lines (38 loc) · 3 KB

Modifying Blueprints for your needs

The general strategy for modifying blueprints will be the same for all blueprints aside from Managed Service for Apache Flink Studio notebooks, as these can be modified in place in the AWS Management console.

Modifying Workflow

  1. Clone this repo
  2. Identify the blueprint that you would like to modify and navigate to it's respective folder under apps/ directory
  3. The code for the project itself should be located under the src/ directory, which you can replace or modify with your own code.
    a. It is strongly encouraged to test your new codebase locally before running the blueprint deploy scripts.

Ready to deploy your new blueprint?

First, you will need to synthesize the template required to launch blueprints in your account

  • For the blueprint in question you are modifying, there will be instructions in the README on how to build the project and upload the assets to an S3 location the CloudFormation Template can access.

Example:

Let's say I am modifying the KDS-to-S3 blueprint to calculate some average statistic as the data is read in.

  • First, I would clone the repo and navigate to apps/java-datastream/kds-to-s3-datastream-java/src/main/java/ and make the proper modifications to the code in StreamingJob.java.

  • Once I am satisfied with the changes, I would compile the application:

mvn compile package

creating a file in the target/ directory of the project called kds-to-s3-datastream-java-1.0.1.jar.

  • Now, I can synthesize my blueprint's template like so:
# navigate to kds-to-s3 template
cd ../apps/java-datastream/kds-to-s3-datastream-java/cdk-infra 

# synthesize blueprint template
cdk synth

And now I have all the assets I need in order to deploy my updated blueprint. Upload these files to an S3 bucket in your AWS account.

Navigate to the root of the directory and type:

export timestampToLetters=$(date +%s)
export BucketName=<<YOUR ASSET BUCKET>>
export BlueprintStackName=kds-to-s3-blueprint-${timestampToLetters}-stack
export AppName=kds-to-s3-demo-${timestampToLetters}-app
export StreamName=kds-to-s3-demo-${timestampToLetters}-stream
export CloudWatchLogGroupName=blueprints/managed-flink-analytics/${AppName}
export CloudWatchLogStreamName=managed-flink-log-stream
export RoleName=kds-to-s3-demo-${timestampToLetters}-role

aws cloudformation create-stack --template-url https://${BucketName}.s3.amazonaws.com/kds-to-s3-datastream-java.json --stack-name $BlueprintStackName --parameters ParameterKey=AppName,ParameterValue=$AppName ParameterKey=CloudWatchLogGroupName,ParameterValue=$CloudWatchLogGroupName ParameterKey=CloudWatchLogStreamName,ParameterValue=$CloudWatchLogStreamName ParameterKey=StreamName,ParameterValue=$StreamName ParameterKey=BucketName,ParameterValue=$BucketName ParameterKey=RoleName,ParameterValue=$RoleName --capabilities CAPABILITY_NAMED_IAM