Override Amplify-generated Cognito resources
The Amplify Auth features have default configurations for its features when you use the amplify/auth/resource.ts
file.
1// amplify/auth/resource.ts2import { defineAuth } from '@aws-amplify/backend';3
4export const auth = defineAuth({5 loginWith: {6 email: true7 }8});
You can customize your authentication resource to enable it to behave exactly as needed for your use cases by modifying it directly using AWS Cloud Development Kit (CDK)
1import { defineBackend } from '@aws-amplify/backend';2import { auth } from './auth/resource.js';3import { data } from './data/resource.js';4
5const backend = defineBackend({6 auth,7 data8});9
10// extract L1 CfnUserPool resources11const { cfnUserPool } = backend.resources.auth.resources.cfnResources;12// use CDK's `addPropertyOverride` to modify properties directly13cfnUserPool.addPropertyOverride('Policies.PasswordPolicy.MinimumLength', 32);