This repository was archived by the owner on Feb 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy patharchive-template.yaml
More file actions
49 lines (47 loc) · 1.5 KB
/
archive-template.yaml
File metadata and controls
49 lines (47 loc) · 1.5 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Parameters:
SourceRepositoryName:
Type: String
Description: Enter the CodeCommit repository name to source for replication.
TargetS3Bucket:
Type: String
Description: Enter the S3 Bucket to target for archive.
Resources:
Archiver:
Type: 'AWS::Serverless::Function'
Properties:
Handler: cwecc.ArchiveRepositoryHandler
Runtime: java8
CodeUri: ./build/distributions/
Description: CodeCommit Archive to S3
MemorySize: 1028
Timeout: 300
Environment:
Variables:
TARGET_S3_BUCKET: !Ref TargetS3Bucket
Events:
ReferenceCreatedOrUpdated:
Type: CloudWatchEvent
Properties:
Pattern:
source:
- aws.codecommit
resources:
- !Sub 'arn:aws:codecommit:${AWS::Region}:${AWS::AccountId}:${SourceRepositoryName}'
detail:
event:
- referenceCreated
- referenceUpdated
Policies:
- Version: '2012-10-17'
Statement:
- Effect: Allow
Resource: !Sub 'arn:aws:codecommit:${AWS::Region}:${AWS::AccountId}:${SourceRepositoryName}'
Action:
- 'codecommit:GetRepository'
- 'codecommit:GitPull'
- Effect: Allow
Resource: !Sub 'arn:aws:s3:::${TargetS3Bucket}/*'
Action:
- 's3:PutObject'