37

There is add-custom-attributes command in cognito-idp but no delete-custom-attributes?

How do I delete them?

Li Li
  • 841
  • 1
  • 7
  • 7

2 Answers2

47

Never mind.

This is not doable at the moment. Under the Custom Attributes it has mentioned that:

Cannot be removed or changed once added to the user pool.

Sampath Dilhan
  • 749
  • 6
  • 17
Li Li
  • 841
  • 1
  • 7
  • 7
  • 46
    I wonder why the custom attributes are non deletable, that does not make sense to me! :/ – dawez Mar 28 '19 at 15:50
  • 6
    This seems like a strange decision, assuming there are no users in the pool with this attribute set. I now have an attribute in the pool which will never be used because I created it as a number when the AWS SDK expects everything as a string. `class com.amazon.coral.value.json.numbers.TruncatingBigNumber can not be converted to an String` – crmpicco Aug 26 '19 at 08:00
  • 2
    Given that we have a limit of 50 custom attributes per user pool, we should be able to delete, custom attributes which are no longer required. – Sampath Dilhan Oct 15 '21 at 10:08
-3

I know this question is over 4 years old. But for me it appears at the top in a Google search. As far as I know there is currently no option in the Cognito UI to delete attributes. But you can use the AWS-CLI to delete the attributes. Here is the official description:

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cognito-idp/admin-delete-user-attributes.html?highlight=admin%20delete%20user%20attributes

I know that this only works for specific users, but one could easy write a batch for this. Don't take me wrong ... it should be a feature of the CLI or the UI, but a batch is at least a workaround.

Rafa Viotti
  • 9,998
  • 4
  • 42
  • 62
Steinliiippp
  • 373
  • 4
  • 20
  • 8
    hmmm not right... the link you have put is to remove the attributes from the particular User not Attribute itself. – Sun Jun 14 '22 at 11:25
  • 1
    As the previous commenter points out, this is a misleading solution. The API call just allows the admin to delete an attribute on a specific user, not remove its definition from the userpool. – Matej Balantič Sep 20 '22 at 16:42