-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
58 lines (53 loc) · 2.09 KB
/
template.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
49
50
51
52
53
54
55
56
57
58
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
submit-deepracer-model-app
Sample SAM Template for submit-deepracer-model-app
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Parameters:
ModelArn:
Type: String
Description: The ARN of the DeepRacer model that will be submitted by a job
LeaderboardArn:
Type: String
Description: The ARN of the Virtual Circuit race where the model will be submitted
Resources:
SubmitModelFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
PackageType: Image
Policies:
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- deepracer:ListLeaderboards
- deepracer:GetModel
- deepracer:ListModels
- deepracer:GetLeaderboard
- deepracer:CreateLeaderboardSubmission
- deepracer:GetLatestUserSubmission
Resource: '*'
Events:
ScheduledFunction:
Type: Schedule
Properties:
Schedule: rate(1 minute)
Input: !Sub '{"ModelArn": "${ModelArn}","LeaderboardArn": "${LeaderboardArn}"}'
Metadata:
DockerTag: python3.7-v1
DockerContext: ./submit_model
Dockerfile: Dockerfile
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
SubmitModelFunction:
Description: "Submit Model Function Lambda Function ARN"
Value: !GetAtt SubmitModelFunction.Arn
SubmitModelFunctionIamRole:
Description: "Implicit IAM Role created for the Lambda function"
Value: !GetAtt SubmitModelFunctionRole.Arn