This resource handler provisions account password policy.
lambda-cform-passwordpolicy Lambda needs following permissions:
Additionally you may want to add following policies to it’s role:
Resource properties are mapped directly to password policy update request, which means that properties are same as in UpdateAccountPasswordPolicyRequest.
Output properties are same as the specified policy. Custom resource ID is set to fixed string.
PasswordPolicyManagerRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Statement:
-
Action: "sts:AssumeRole"
Effect: "Allow"
Principal:
Service:
- "lambda.amazonaws.com"
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
Policies:
-
PolicyName: "AllowManagingPasswordPolicy"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Action:
- "iam:DeleteAccountPasswordPolocy"
- "iam:UpdateAccountPasswordPolicy"
Effect: "Allow"
Resource:
- "*"
PasswordPolicyManager:
Type: "AWS::Lambda::Function"
Properties:
Runtime: "java8"
Code:
# put your source bucket
S3Bucket: "your-bucket"
S3Key: "lambda-cform-passwordpolicy-1.0.2-standalone.jar"
Handler: "pl.wrzasq.lambda.cform.passwordpolicy.Handler::handle"
MemorySize: 256
Description: "AWS password policy manager deployment."
Timeout: 300
TracingConfig:
Mode: "Active"
Role: !GetAtt "PasswordPolicyManagerRole.Arn"
PasswordPolicy:
Type: "AWS::CloudFormation::CustomResource"
Properties:
# reference to deploy function
ServiceToken: !GetAtt "PasswordPolicyManager.Arn"
minimumPasswordLength: 8
requireLowercaseCharacters: true
requireUppercaseCharacters: true
requireNumbers: true
requireSymbols: true
allowUsersToChangePassword: true
passwordReusePrevention: 2
maxPasswordAge: 90
hardExpiry: false