-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
83 lines (78 loc) · 2.46 KB
/
serverless.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
service: vidhub-img # NOTE: update this with your service name
provider:
name: aws
runtime: nodejs6.10
memorySize: 1536
stage: production
region: us-east-1 # Update to whatever region you would like
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:ListBucket"
Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
- Effect: "Allow"
Action:
- "s3:PutObject"
Resource:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref" : "ServerlessDeploymentBucket"
- "/*"
- Effect: "Allow"
Action:
- "s3:ListBucket"
- "s3:PutObject"
- "s3:PutObjectAcl"
Resource: arn:aws:s3:::img.vidhub.co/* # the bucket ARN to store images in
functions:
index:
handler: handler.index
events:
- http:
path: /{img}
method: get
environment:
S3_BUCKET: img.vidhub.co # bucket name to store images
resources:
Resources:
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Aliases:
- img.vidhub.co # DNS to replace CloudFront's
Origins:
- DomainName: { "Fn::Join": [ ".", [ { "Ref": "ApiGatewayRestApi" }, "execute-api", "us-east-1", "amazonaws.com" ] ] }
OriginPath: /production
Id: vidhub-img
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
OriginSSLProtocols:
- TLSv1
- TLSv1.1
- TLSv1.2
DefaultCacheBehavior:
AllowedMethods:
- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
TargetOriginId: vidhub-img
ViewerProtocolPolicy: redirect-to-https
ForwardedValues:
Cookies:
Forward: none
QueryString: true
Enabled: true
Comment: Vidhub Img # Can be whatever
DefaultRootObject: index.html
ViewerCertificate:
AcmCertificateArn: arn:aws:acm:us-east-1:563115270151:certificate/826e8b5b-3ace-4fdf-83be-330a66a27ee7 # A certificate in ACM for the DNS being used
SslSupportMethod: sni-only
PriceClass: PriceClass_100