Last active
September 29, 2019 01:38
-
-
Save wolfeidau/f9bc636c1882de59f160d303f3389800 to your computer and use it in GitHub Desktop.
Parameters fragment from cdk synth'd CDK template... No idea what i would do with this template to be honest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Construct, StackProps, Stack } from '@aws-cdk/core'; | |
import { Function, Runtime, Code } from '@aws-cdk/aws-lambda'; | |
import { Table, AttributeType, BillingMode } from '@aws-cdk/aws-dynamodb'; | |
import { Bucket, BucketEncryption, EventType } from '@aws-cdk/aws-s3'; | |
import { LambdaRestApi } from '@aws-cdk/aws-apigateway'; | |
import { S3EventSource } from '@aws-cdk/aws-lambda-event-sources'; | |
export class InfraStack extends Stack { | |
constructor(scope: Construct, id: string, props?: StackProps) { | |
super(scope, id, props); | |
const projectTable = new Table(this, 'Projects', { | |
partitionKey: { | |
type: AttributeType.STRING, | |
name: 'id', | |
}, | |
sortKey: { | |
type: AttributeType.STRING, | |
name: 'customer_id', | |
}, | |
serverSideEncryption: true, | |
billingMode: BillingMode.PAY_PER_REQUEST, | |
pointInTimeRecovery: true, | |
}) | |
const sourceBucket = new Bucket(this, 'Sources', { | |
encryption: BucketEncryption.KMS_MANAGED, | |
}); | |
const testfunkAPILambda = new Function(this, 'testfunkAPI', { | |
runtime: Runtime.GO_1_X, | |
code: Code.asset('deploy/testfunk.zip'), | |
handler: `testfunk-api`, | |
environment: { | |
PROJECT_TABLE_NAME: projectTable.tableName, | |
} | |
}); | |
projectTable.grantReadWriteData(testfunkAPILambda.role!); | |
// defines an API Gateway REST API resource backed by our "hello" function. | |
new LambdaRestApi(this, 'RestEndpoint', { | |
handler: testfunkAPILambda | |
}); | |
const testfunks3UploadLambda = new Function(this, 'testfunkS3upload', { | |
runtime: Runtime.GO_1_X, | |
code: Code.asset('deploy/testfunk.zip'), | |
handler: `testfunk-s3upload`, | |
environment: { | |
PROJECT_TABLE_NAME: projectTable.tableName, | |
} | |
}); | |
projectTable.grantReadWriteData(testfunks3UploadLambda.role!); | |
sourceBucket.grantRead(testfunks3UploadLambda.role!); | |
testfunks3UploadLambda.addEventSource(new S3EventSource(sourceBucket, { | |
events: [ EventType.OBJECT_CREATED ], | |
})); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parameters: | |
testfunkAPICodeS3Bucket1F1C5F72: | |
Type: String | |
Description: S3 bucket for asset "InfraStack/testfunkAPI/Code" | |
testfunkAPICodeS3VersionKey307E5CFB: | |
Type: String | |
Description: S3 key for asset version "InfraStack/testfunkAPI/Code" | |
testfunkAPICodeArtifactHash613B43DE: | |
Type: String | |
Description: Artifact hash for asset "InfraStack/testfunkAPI/Code" | |
testfunkS3uploadCodeS3BucketA184EA4B: | |
Type: String | |
Description: S3 bucket for asset "InfraStack/testfunkS3upload/Code" | |
testfunkS3uploadCodeS3VersionKey1D2518AD: | |
Type: String | |
Description: S3 key for asset version "InfraStack/testfunkS3upload/Code" | |
testfunkS3uploadCodeArtifactHash5BD6FE1B: | |
Type: String | |
Description: Artifact hash for asset "InfraStack/testfunkS3upload/Code" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment