1+ AWSTemplateFormatVersion : ' 2010-09-09'
2+ Transform : ' AWS::Serverless-2016-10-31'
3+ Description : Deploys HNAP JSON harvester solution + GeoNetwork to geocore translation
4+
5+ Parameters :
6+ Environment :
7+ Type : AWS::SSM::Parameter::Value<String>
8+ Default : /webpresence/environment
9+ Description : SSM parameter name for environment
10+ DeploymentBucket :
11+ Type : AWS::SSM::Parameter::Value<String>
12+ Default : /webpresence/deployment-bucket
13+ Description : S3 bucket where all deployment files are stored
14+ SvelteBucketString :
15+ Type : String
16+ Description : Unique string generated by the svelte app.geo.ca v2 deployment
17+
18+ Conditions :
19+ IsProd : !Equals [prod, !Ref Environment]
20+ IsStage : !Equals [stage, !Ref Environment]
21+ IsDev : !Equals [dev, !Ref Environment]
22+
23+ Resources :
24+ HnapJsonHarvesterAppGeoCav2 :
25+ Type : AWS::Serverless::Function
26+ Properties :
27+ Runtime : python3.9
28+ Role : !GetAtt LambdaExecutionRole.Arn
29+ CodeUri :
30+ Bucket : !Ref DeploymentBucket
31+ Key :
32+ Fn::If :
33+ - IsProd
34+ - cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
35+ - Fn::If :
36+ - IsStage
37+ - cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
38+ - cloudformation-templates/lambda/geocore-hnap-harvest/geocore-hnap-harvest-20241212-1100.zip
39+ MemorySize : 3009
40+ Handler : app.lambda_handler
41+ Timeout : 900
42+ Environment :
43+ Variables :
44+ BUCKET_NAME : !Sub 'app-geo-ca-pv-datalake-${SvelteBucketString}/hnap'
45+ GEOJSON_BUCKET_NAME : !Sub 'app-geo-ca-pv-datalake-${SvelteBucketString}/geojson'
46+ BASE_URL : ' https://maps.canada.ca'
47+ GN_JSON_RECORD_URL_START : ' https://maps.canada.ca/geonetwork/srv/api/0.1/records/'
48+ RUN_INTERVAL_MINUTES : 11
49+ Layers :
50+ - arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python39:8
51+
52+ HnapJsonHarvesterRule :
53+ Type : AWS::Events::Rule
54+ Properties :
55+ Name : !Sub 'harvester-10mins-app-geo-ca-v2-${Environment}'
56+ Description : Harvester on a 10 minute interval
57+ State : DISABLED
58+ ScheduleExpression : ' rate(10 minutes)'
59+ Targets :
60+ -
61+ Arn :
62+ Fn::GetAtt :
63+ - HnapJsonHarvesterAppGeoCav2
64+ - Arn
65+ Id : !Ref HnapJsonHarvesterAppGeoCav2
66+
67+ PermissionForEventsToInvokeHarvesterLambda :
68+ Type : AWS::Lambda::Permission
69+ Properties :
70+ FunctionName : !Ref HnapJsonHarvesterAppGeoCav2
71+ Action : ' lambda:InvokeFunction'
72+ Principal : ' events.amazonaws.com'
73+ SourceArn : !GetAtt
74+ - HnapJsonHarvesterRule
75+ - Arn
76+
77+ LambdaExecutionRole :
78+ Type : AWS::IAM::Role
79+ Properties :
80+ AssumeRolePolicyDocument :
81+ Version : ' 2012-10-17'
82+ Statement :
83+ - Effect : Allow
84+ Principal :
85+ Service :
86+ - lambda.amazonaws.com
87+ Action :
88+ - sts:AssumeRole
89+ ManagedPolicyArns :
90+ - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
91+ Policies :
92+ - PolicyName : ' policy'
93+ PolicyDocument :
94+ Version : ' 2012-10-17'
95+ Statement :
96+ - Effect : ' Allow'
97+ Action :
98+ - ' s3:*'
99+ Resource :
100+ - !Sub arn:aws:s3:::app-geo-ca-pv-datalake-${SvelteBucketString}
101+ - !Sub arn:aws:s3:::app-geo-ca-pv-datalake-${SvelteBucketString}/*
102+
103+ LogGroup :
104+ Type : Custom::LogGroup
105+ Properties :
106+ ServiceToken : !ImportValue LogGroupHelperLambdaArn
107+ LogGroupName : !Sub '/${Environment}/webpresence/hnap_json_harvest_app-geo-ca-v2'
108+ RetentionInDays : 3653
0 commit comments