-
Notifications
You must be signed in to change notification settings - Fork 16
/
template-sar.yaml
48 lines (48 loc) · 1.41 KB
/
template-sar.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
BucketName:
Type: String
Description: Bucket name which the lambda will access
Transform: AWS::Serverless-2016-10-31
Description: Spring Cloud Functions.
Resources:
S3BucketRef:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Ref BucketName
AwsLambdaS3Local:
Type: AWS::Serverless::Function
Properties:
FunctionName: aws-lambda-s3
Handler: com.mj.aws.lambda.s3.AwsLambdaS3FunctionHandler
Description: For AWS S3
Runtime: java8
CodeUri: s3://my-sar-artifact/aws-lambda-s3/aws-lambda-s3-0.0.2-SNAPSHOT-aws.jar
MemorySize: 320
Timeout: 240
Policies:
- AWSLambdaExecute
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:GetObject
- s3:GetObjectVersion
Resource:
- Fn::Sub:
- arn:${AWS::Partition}:s3:::${bucketName}
- bucketName:
Ref: BucketName
- Fn::Sub:
- arn:${AWS::Partition}:s3:::${bucketName}/*
- bucketName:
Ref: BucketName
Events:
ObjectUpload:
Type: S3
Properties:
Bucket: !Ref S3BucketRef
Events: s3:ObjectCreated:*
Environment:
Variables:
SPRING_PROFILES_ACTIVE: aws