-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.yaml
44 lines (41 loc) · 1.38 KB
/
template.yaml
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
Transform: 'AWS::Serverless-2016-10-31'
Resources:
SigningKey:
Type: AWS::SecretsManager::Secret
Properties:
Description: Signing key
GenerateSecretString:
PasswordLength: 4096
SigningKeyRotationSchedule:
Type: AWS::SecretsManager::RotationSchedule
Properties:
RotationLambdaARN: !GetAtt SigningKeyRotationLambda.Arn
RotationRules:
AutomaticallyAfterDays: 1
SecretId: !Ref SigningKey
SigningKeyRotationLambda:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs12.x
Handler: app.lambdaHandler
CodeUri: ./src
Policies:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
- arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess
- Statement:
- Effect: Allow
Action:
- secretsmanager:DescribeSecret
- secretsmanager:GetSecretValue
- secretsmanager:PutSecretValue
- secretsmanager:UpdateSecretVersionStage
Resource: !Ref SigningKey
- Effect: Allow
Action: secretsmanager:GetRandomPassword
Resource: '*'
SigningKeyRotationLambdaPermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !GetAtt SigningKeyRotationLambda.Arn
Action: lambda:InvokeFunction
Principal: secretsmanager.amazonaws.com