Is it possible to add Cognito additional custom or standard user attributes post pool creation and once the pool is being used?
In other words is the Schema for the pool totally locked or can we add more custom attributes to it?
Is it possible to add Cognito additional custom or standard user attributes post pool creation and once the pool is being used?
In other words is the Schema for the pool totally locked or can we add more custom attributes to it?
On AWS Cognito, you have two types of attributes:
Standard Attributes: These attributes were selected when the pool was created and cannot be changed.
Custom Attributes: These attributes can be added. Once they are added, they cannot be removed or changed
@ThomasVdBerge is somewhat correct but the answer needs to be more complete and helpful. At this time custom attributes are poorly setup by AWS. For example, you can't find the field you entered in the Console included in user objects returned by various JS SDK api's unless you have a value in it. To do that you have to enter the value with the CLI, which is unworkable for real apps that are meant for users to enter data with a GUI.
The adminCreateUser api doc states this: "For custom attributes, you must prepend the custom: prefix to the attribute name." However, this crashes JavaScript unless you stringify it as below in my edit.
EDIT:
I've added my code for creating a user form. With this setup I can add user ID's and this field will show in the returned object in the console and in the Cognito database of users.
What I've said above is still correct if you want to add data to a custom field and want to do something with it. Adding users with an interface this way works.
const createUserParams = {
...
UserAttributes: [
{
Name: 'custom:user_id',
Value: enteredData.user_id
},