Repository navigation
Expand file tree
/
Copy pathtemplate.yaml
More file actions
69 lines (65 loc) · 2.35 KB
/
Copy pathtemplate.yaml
File metadata and controls
69 lines (65 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: "Redshift Data API Lambda example"
Parameters:
- RedshiftSecretArn
- RedshiftClusterId
- RedshiftClusterDatabase
- SQLStatement
ParameterLabels:
RedshiftSecretArn:
default: "Secret Mager ARN for RS cluster"
RedshiftClusterId:
default: "Id for the Redshift cluster to be used"
RedshiftClusterDatabase:
default: "Database name to be used in the provided redshift cluster"
SQLStatement:
default: "SQL statement to be executed by the RS data API"
Parameters:
RedshiftSecretArn:
Type: String
Description: 'Enter the ARN of the secret containing the user and password fot the RS cluster'
MinLength: 20
MaxLength: 2048
RedshiftClusterId:
Type: String
Description: 'Enter the id of your Redshift cluster'
MinLength: 1
MaxLength: 63
AllowedPattern: '([a-z]|[A-Z]|[0-9]|-)*'
RedshiftClusterDatabase:
Type: String
Description: 'Enter the database name to be used in your Redshift cluster'
MinLength: 1
MaxLength: 127
SQLStatement:
Type: String
Description: 'Enter the SQL statement to be executed'
Resources:
# See https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html
# for more info to see how to tune the lambda function configs based on your use case.
AppFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: java8
Handler: com.example.myapp.App::handleRequest
Timeout: 60
MemorySize: 512
CodeUri: ./target/myapp.jar
# Attach policies here to give the function permission to access other AWS resources if needed
# See: https://github.com/awslabs/serverless-application-model/blob/master/docs/policy_templates.rst
# eg:
Policies:
- AmazonRedshiftDataFullAccess
Environment:
Variables:
RS_SECRET_ARN: !Ref RedshiftSecretArn
RS_CLUSTER_ID: !Ref RedshiftClusterId
RS_CLUSTER_REGION: !Ref "AWS::Region"
RS_CLUSTER_DATABASE: !Ref RedshiftClusterDatabase
SQL_STATEMENT: !Ref SQLStatement