Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 2.55 KB

adr-002-idempotent-event-processing.md

File metadata and controls

25 lines (15 loc) · 2.55 KB

002. Idempotent Event Processing for IAM Policy Generation and Deletion

Date: 2023-07-06

Context

Our application receives an event stream from another software system and is responsible for generating or deleting AWS Identity and Access Management (IAM) policies based on these events. To ensure the integrity of IAM policies and prevent unintended consequences, it is crucial that all actions performed by the application are idempotent. This means that processing the same event multiple times should not result in the creation of duplicate policies or the removal of policies that are still in use. It is essential to design a system that can handle duplicate events and ensure correct order processing while maintaining the consistency of IAM policies.

Decision

We have decided to implement an idempotent event processing mechanism for IAM policy generation and deletion in our application. This decision is based on the following considerations:

  1. Data Integrity: By making the generation and deletion of IAM policies idempotent, we can ensure that processing duplicate events does not result in the creation of duplicate policies or the removal of policies that are still in use. This prevents unintended consequences and maintains the integrity of IAM policies.

  2. Idempotent Policy Generation: When processing events, the application will check if an IAM policy already exists before attempting to generate a new policy. If a policy with the same name and content exists, the application will not create a duplicate policy but will instead verify that the existing policy is up to date. This approach avoids policy duplication and maintains consistency.

  3. Idempotent Policy Deletion: Similarly, when processing events for policy deletion, the application will check if the policy to be deleted exists and is not attached to any IAM entities (such as users or roles). If the policy is in use, it will not be deleted. This ensures that policies are only deleted when they are no longer needed, preventing accidental removal of policies still in use.

Consequences

  • Ensures the integrity of IAM policies by preventing the creation of duplicates and accidental removal of policies still in use.
  • Supports handling of duplicate events without causing harm or inconsistency in IAM policy management.
  • Maintains data consistency by enforcing idempotency during policy generation and deletion.
  • Requires careful implementation and testing of idempotent policy generation and deletion logic.
  • Increased complexity in handling event duplicates and policy dependencies.