Repository navigation
Expand file tree
/
Copy pathtemplate.yaml
More file actions
60 lines (55 loc) · 2.17 KB
/
Copy pathtemplate.yaml
File metadata and controls
60 lines (55 loc) · 2.17 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
A SAM application to invoke a Lambda that calls the Bedrock Titan Image Generator then stores the output in S3 and logs in CloudWatch
Globals:
Function:
Timeout: 60
MemorySize: 128
Resources:
S3ImageGeneratorFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3imagegenerator/
Handler: app.lambda_handler
Runtime: python3.8 # Ensure this matches the Python version you're using in s3imagegenerator
Policies:
- S3CrudPolicy:
BucketName: "s3imagegenerator" # Replace with your actual S3 bucket name
- Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "bedrock-runtime:InvokeModel"
Resource: "*" # Adjust based on specific needs
- Effect: Allow
Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Resource: "arn:aws:logs:*:*:*"
Events:
TitanImageApi:
Type: Api
Properties:
Path: /generate-image
Method: post
Outputs:
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
HelloWorldFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt HelloWorldFunction.Arn
HelloWorldFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt HelloWorldFunctionRole.Arn
S3ImageGeneratorApi:
Description: "API Gateway endpoint URL for Prod stage for S3 Image Generator function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/generate-image/"
S3ImageGeneratorFunction:
Description: "S3 Image Generator Function ARN"
Value: !GetAtt S3ImageGeneratorFunction.Arn
S3ImageGeneratorFunctionIamRole:
Description: "Implicit IAM Role created for S3 Image Generator function"
Value: !GetAtt S3ImageGeneratorFunction.Arn