mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
AWS updates (#447)
* AWS updates * CloudFormation stack parameter for changing CloudFront tile cache TTL. * S3 requests are always set as Requester Pays, enabling fetching from buckets in other accounts.
This commit is contained in:
@@ -2,10 +2,15 @@ AWSTemplateFormatVersion: '2010-09-09'
|
|||||||
Description: Serve Z/X/Y tiles through CloudFront + Lambda from an existing S3 bucket.
|
Description: Serve Z/X/Y tiles through CloudFront + Lambda from an existing S3 bucket.
|
||||||
Parameters:
|
Parameters:
|
||||||
BucketName:
|
BucketName:
|
||||||
Description: 'Name of an existing S3 bucket with .pmtiles tilesets. Should be in the same region as your CloudFormation stack.'
|
Description: 'Name of an existing S3 bucket with .pmtiles tilesets. Should be in the same region as your CloudFormation stack. Can be a RequesterPays bucket in another account.'
|
||||||
Type: String
|
Type: String
|
||||||
MinLength: 1
|
MinLength: 1
|
||||||
|
|
||||||
|
DefaultTTL:
|
||||||
|
Description: Default time-to-live for cached tiles in the CloudFront distribution.
|
||||||
|
Type: Number
|
||||||
|
Default: 86400
|
||||||
|
|
||||||
AllowedOrigins:
|
AllowedOrigins:
|
||||||
Description: 'Comma-separated list of domains (e.g. example.com) allowed by browser CORS policy, or * for all origins.'
|
Description: 'Comma-separated list of domains (e.g. example.com) allowed by browser CORS policy, or * for all origins.'
|
||||||
Type: List<String>
|
Type: List<String>
|
||||||
@@ -17,11 +22,12 @@ Parameters:
|
|||||||
|
|
||||||
Outputs:
|
Outputs:
|
||||||
CloudFrontDistributionUrl:
|
CloudFrontDistributionUrl:
|
||||||
Description: 'URL of the CloudFront distribution'
|
Description: 'URL of the CloudFront distribution for cached tiles.'
|
||||||
Value: !Sub "https://${CloudFrontDistribution.DomainName}"
|
Value: !Sub "https://${CloudFrontDistribution.DomainName}"
|
||||||
Export:
|
Export:
|
||||||
Name: !Sub "${AWS::StackName}-CloudFrontDistributionURL"
|
Name: !Sub "${AWS::StackName}-CloudFrontDistributionURL"
|
||||||
|
|
||||||
|
|
||||||
Conditions:
|
Conditions:
|
||||||
IsPublicHostnameProvided:
|
IsPublicHostnameProvided:
|
||||||
Fn::Not:
|
Fn::Not:
|
||||||
@@ -127,7 +133,7 @@ Resources:
|
|||||||
Properties:
|
Properties:
|
||||||
CachePolicyConfig:
|
CachePolicyConfig:
|
||||||
Name: !Sub "${AWS::StackName}-CachePolicyConfig"
|
Name: !Sub "${AWS::StackName}-CachePolicyConfig"
|
||||||
DefaultTTL: 86400
|
DefaultTTL: !Ref DefaultTTL
|
||||||
MaxTTL: 31536000
|
MaxTTL: 31536000
|
||||||
MinTTL: 0
|
MinTTL: 0
|
||||||
ParametersInCacheKeyAndForwardedToOrigin:
|
ParametersInCacheKeyAndForwardedToOrigin:
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ class S3Source implements Source {
|
|||||||
Range: "bytes=" + offset + "-" + (offset + length - 1),
|
Range: "bytes=" + offset + "-" + (offset + length - 1),
|
||||||
// biome-ignore lint: aws api
|
// biome-ignore lint: aws api
|
||||||
IfMatch: etag,
|
IfMatch: etag,
|
||||||
|
// biome-ignore lint: aws api
|
||||||
|
RequestPayer: "requester",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
|
|||||||
Reference in New Issue
Block a user