<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stanislav Ivanov on Medium]]></title>
        <description><![CDATA[Stories by Stanislav Ivanov on Medium]]></description>
        <link>https://medium.com/@stanislav.ivanov9213?source=rss-e7e05478e373------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jWKtsisE8xlY4Bw-</url>
            <title>Stories by Stanislav Ivanov on Medium</title>
            <link>https://medium.com/@stanislav.ivanov9213?source=rss-e7e05478e373------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:57:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stanislav.ivanov9213/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[4 Tips for better permissions management in AWS IAM]]></title>
            <link>https://medium.com/@stanislav.ivanov9213/4-tips-for-better-permissions-management-in-aws-iam-e310181b478a?source=rss-e7e05478e373------2</link>
            <guid isPermaLink="false">https://medium.com/p/e310181b478a</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[iam-roles]]></category>
            <dc:creator><![CDATA[Stanislav Ivanov]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 04:47:20 GMT</pubDate>
            <atom:updated>2023-07-06T04:47:20.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AWS IAM Tips header" src="https://cdn-images-1.medium.com/max/680/1*bxQYgnj_xf6YkJDCDuWbqQ.png" /></figure><h3>Introduction</h3><p>Managing permissions in the cloud can be a daunting task. The abundance of options and menus in AWS IAM (Identity and Access Management) often leads to confusion and, at times, frustration. However, getting permission management right is crucial for maintaining a secure and efficient cloud infrastructure. In this article, we will explore some best practices and strategies to simplify and optimize permission management in AWS IAM.</p><h3>Tips</h3><ol><li>Embrace Roles for Software Authorization: When authorizing your software to communicate with AWS services through the AWS SDK, it is recommended to use Roles instead of individual user credentials. By creating dedicated roles for your applications, you can ensure secure communication and minimize the risk associated with exposing user credentials. Roles serve as a means to authorize your software with AWS, enabling seamless and secure interactions.</li><li>Secure S3 Buckets with Custom Resource-Based Policies: By default, it is advisable to keep all your S3 Buckets closed to public access unless your specific use case requires public access. To manage access effectively, employ custom resource-based policies. These policies provide granular control over who can access your S3 Buckets and how they can interact with the stored objects. Implementing resource-based policies helps maintain data privacy and prevent unauthorized access.</li><li>Granular Permissions: Role Separation and Temporary Assumption: Granting users broad sets of permissions, beyond what they need for their regular duties, can introduce unnecessary security risks. Instead, opt for role separation by assigning specific permissions to users based on their tasks. By separating permissions into roles, you can ensure that users only have access to the necessary resources and actions. Additionally, consider allowing users to temporarily assume roles when performing specific tasks, further limiting their permissions and enhancing security.</li><li>Leverage User Groups for Streamlined Permission Management: To simplify permission management and maintain consistency across your organization, make extensive use of user groups. Group users based on their roles and responsibilities, and assign permissions to the groups rather than individual users. This approach reduces administrative overhead, ensures uniform access control policies, and allows for efficient onboarding and offboarding of users. By leveraging user groups, you establish a scalable and manageable permission structure.</li></ol><h3>Conclusion</h3><p>Effectively managing permissions in AWS IAM is essential for maintaining a secure and efficient cloud environment. By following these best practices, you can simplify the permission management process, reduce security risks, and ensure the right level of access for your users. Embrace roles for software authorization, secure S3 Buckets with resource-based policies, adopt granular permissions through role separation and temporary assumption, and leverage user groups for streamlined permission management. By implementing these strategies, you can achieve optimal permission management in the cloud and establish a robust security posture for your AWS infrastructure.</p><p>Remember, permission management is an ongoing process that requires regular reviews and updates to adapt to changing requirements and mitigate evolving security risks. Stay proactive, stay vigilant, and continue to refine your permission management practices to protect your cloud resources effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e310181b478a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CQRS: Separating Responsibilities for Efficient Data Management]]></title>
            <link>https://medium.com/@stanislav.ivanov9213/cqrs-separating-responsibilities-for-efficient-data-management-d29e2fcf6f18?source=rss-e7e05478e373------2</link>
            <guid isPermaLink="false">https://medium.com/p/d29e2fcf6f18</guid>
            <category><![CDATA[cqrs]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Stanislav Ivanov]]></dc:creator>
            <pubDate>Mon, 26 Jun 2023 05:00:36 GMT</pubDate>
            <atom:updated>2023-06-26T05:00:36.010Z</atom:updated>
            <content:encoded><![CDATA[<h3>Breakdown</h3><ol><li>Overview</li><li>What is CQRS ?</li></ol><ul><li>Definition and main components</li><li>Separation of concerns</li><li>Difference to the typical CRUD model</li><li>Scalability benefits</li><li>Added complexity to the overall development</li></ul><p>3. Main components</p><ul><li>Commands</li><li>Queries</li><li>Events</li></ul><p>4. Data storage</p><ul><li>Data separation and projections</li><li>Data store flexibility and diversity of options</li><li>Synchronization and eventual consistency</li></ul><p>5. Use cases and what problems does it solve</p><p>6. Some notes on event-sourcing</p><h3>Overview</h3><p>In the following article, we will delve into the concept of <strong>Command and Query Responsibility Segregation</strong> (CQRS), what need is there for us to consider it, what level of complexity it can bring, and when it is completely justified to adopt this architecture. Additionally, I will touch on its components and different combinations you can typically see it implemented with, like event-driven architectures or even event-sourcing. Although the article will not go into too much detail about side topics.</p><h3>What is CQRS ?</h3><p>Command and Query Responsibility Segregation (CQRS) is a software architecture pattern that separates the responsibilities of read and write operations in a system. Instead of using the same models for both reading and writing data, CQRS introduces a clear distinction between the two operations.</p><p>At its core, CQRS recognizes that read and write operations have different requirements and can benefit from different optimizations. By segregating these responsibilities, CQRS enables developers to design systems that are more efficient, scalable, and maintainable.</p><p>In a traditional CRUD (Create, Read, Update, Delete) system, the same models and data access layers are often used for both reading and writing data. However, as systems grow in complexity, this approach can lead to performance bottlenecks and limited scalability. CQRS addresses these issues by introducing separate models and data access layers for read and write operations.</p><p>Implementing CQRS introduces additional complexity compared to traditional approaches. Developers need to design and maintain separate models, data access layers, and possibly even different storage mechanisms for read and write operations. However, this added complexity can be justified in scenarios where the benefits of scalability, performance, and maintainability outweigh the costs.</p><h3>Main components</h3><p>The key idea behind CQRS is that write operations, also known as commands, focus on changing the system’s state. These commands typically involve validation, business logic, and updating the underlying data store. On the other hand, read operations, known as queries, are concerned with retrieving data without modifying the system’s state. Queries are performed on materialized views, which are precomputed representations of the data optimized for specific read patterns.</p><h3>Commands</h3><p>Commands represent the intent to perform a specific action or change within the system. They encapsulate the necessary information and parameters to execute a command-oriented operation. Commands are responsible for initiating changes to the data or triggering relevant business logic. This type of operation is responsible for performing only 1 change to the system state, after the command is received and recorded by the command handler, the system can trigger different side effects based on the type and essence of the command. For example, check the chart below.</p><figure><img alt="CQRS Command structure" src="https://cdn-images-1.medium.com/max/1024/1*NjL9CO8efE4UzTccJ7XIJQ.png" /></figure><h3>Queries</h3><p>Unlike commands, which focus on write operations, queries are concerned with retrieving data based on specific criteria or conditions. They represent the questions we ask the system to obtain relevant information. For example, querying for a list of products that meet certain criteria or retrieving user details based on a specific identifier. Queries are used to fetch information or perform read operations on the data model.</p><p>Queries are typically executed by query handlers, which are responsible for retrieving the requested data from appropriate data stores, such as databases or caches. The query handler receives the query, performs the necessary operations, and returns the result set or data object to the caller.</p><p>Additionally queries should not be used to perform state changes or trigger any side effects in the system.</p><p>Because the purpose of CQRS is to place a “wall” between both sides, we can be even more flexible and design the system in a way that allows us to send the commands to one application, and the queries to another if there is the need for it.</p><figure><img alt="CQRS query structure" src="https://cdn-images-1.medium.com/max/688/1*zzaRoyQYSBElRxQ-qzO_bg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*WVxsMWFrOqCqpNUe11qsBA.png" /></figure><p>By separating the read and write responsibilities, CQRS allows each side to be optimized independently. This means that read models can be denormalized, tailored for specific use cases, and optimized for efficient querying. On the write side, models can focus solely on capturing the intent of the operation and enforcing business rules.</p><p>One of the main advantages of CQRS is its scalability options. Since read and write operations are decoupled, it becomes easier to scale each side independently based on the specific demands of the system. For example, read models can be replicated or distributed across multiple nodes to handle high read loads, while write models can be optimized for write-intensive operations.</p><p>CQRS is not a one-size-fits-all solution and should be considered in cases where a clear distinction between read and write responsibilities is necessary. It is particularly beneficial in scenarios where the read and write patterns differ significantly, such as in business intelligence or reporting systems. CQRS also shines in complex domains where the separation of concerns improves code readability and maintainability.</p><h3>Events</h3><p>When adopting CQRS, it’s common to leverage event-driven messaging to handle communication between different components. Events are used to propagate changes made by write operations and can be processed asynchronously by various consumers. This allows for loose coupling, scalability, and the potential for eventual consistency across the system.</p><figure><img alt="Event driven side effect" src="https://cdn-images-1.medium.com/max/796/1*POAhCesdg3iP933WKlAOWw.png" /></figure><h3>Data storage</h3><p>You have several options when it comes to modeling your data management. Of course, you can implement a single data store, so that the commands write to the same store the queries read from. Which has a lot of added value, by ensuring data consistency and perhaps some cost optimization.</p><p>There is also the option to break down the way data is written and read. We can have the commands write the data to a table in one schema for example, and with projection views we can reconstruct this data in other tables elsewhere. Of course, we can push past these limits and start reading from a completely different data store than the one we are writing to. Image is a use case where we write all commands and their result to a relational database, and with the addition of some synchronization, we can read the projection of this data from a NoSql database.</p><figure><img alt="Different storage for read and write" src="https://cdn-images-1.medium.com/max/881/1*pHCoNOEMM9HcMy9UHYKZEg.png" /></figure><figure><img alt="Same database storage" src="https://cdn-images-1.medium.com/max/976/1*fageDlrSQsNUNP8vK0Bm0g.png" /></figure><h3>Eventual consistency</h3><p>We define eventual consistency by referring to a state where all copies of data will be consistent and hold the same information, but not at first or immediately.</p><p>However, it’s important to note that eventual consistency can introduce challenges in terms of data synchronization between the read and write sources. Strategies like event sourcing, where events are stored as the system’s source of truth, can be used to address these challenges. Event sourcing complements CQRS by providing a reliable log of events that can be used to rebuild materialized views or synchronize read models.</p><h3>Use cases and what problems can CQRS solve</h3><p>Let’s start this part with one important thought, do not try to solve problems you don’t have currently or will not have in the near future. Look at what’s in front of you. If CQRS would bring too many changes and requirements for development, no need to focus on it when you’re a startup trying to enter a market.</p><p>Here are a few use cases for this architecture that I think are quite relevant:</p><ul><li>You want to focus on scaling read from write capacity separately. Perhaps you need to increase and optimize your read throughput or maybe your write capacity and speed is holding you back</li><li>Loose coupling — You want to decouple your application, and keep the domain or business logic cleaner.</li><li>You want further flexibility in your storage solutions, where you can choose from different technology stacks for each of side of the application</li><li>You are not concerned about eventual consistency (or rather delayed consistency)</li><li>It is great at reducing complexity in entangled code bases, where the domain logic has risen tremendously. Separate the different concerns in the operations, which achieves good readability and understanding of the overall processes.</li><li>You need to perform business intelligence or reporting/analytics where the read patterns can really differ. Read queries can contain a lot of different data and combinations of data. In cases where you need to think about BI and combining, and querying data you will need to consider something like a warehousing solution. You can give a separate projection for BI purposes, not interfering with the regular database for OLTP — online transaction processing</li></ul><h3>Some notes on event-sourcing</h3><p>When combined with event-sourcing, the system stores all changes as an unchangeable sequence of events, enabling reliable auditing, temporal querying, and the ability to rebuild state at any point in time. This combination provides a solid foundation for building highly scalable, maintainable, and event-driven applications. CQRS with event-sourcing revolutionizes data management by introducing a new level of flexibility, auditability, and temporal querying capabilities.</p><figure><img alt="Event sourcing example" src="https://cdn-images-1.medium.com/max/561/1*V0kNkSqxVZbeKtzHFdUDAQ.png" /></figure><p>In conclusion, CQRS is a powerful pattern that offers advantages in terms of scalability, performance, and maintainability. By separating the responsibilities of read and write operations, developers can optimize each side independently and design systems that better align with specific requirements. While implementing CQRS introduces complexity, it can be a valuable approach in scenarios where the benefits outweigh the costs, such as in complex domains or systems with distinct read-and-write patterns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d29e2fcf6f18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should you be using serverless? My use of serverless workflows]]></title>
            <link>https://medium.com/@stanislav.ivanov9213/should-you-be-using-serverless-my-use-of-serverless-workflows-814ee9d32e51?source=rss-e7e05478e373------2</link>
            <guid isPermaLink="false">https://medium.com/p/814ee9d32e51</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Stanislav Ivanov]]></dc:creator>
            <pubDate>Wed, 24 May 2023 07:33:56 GMT</pubDate>
            <atom:updated>2023-05-24T07:33:56.808Z</atom:updated>
            <content:encoded><![CDATA[<p>There are a lot of opinions on the subject of serverless, whether it has a place in 2023, and how traditional architectures are better, but I believe there are still good use cases for serverless, just as any tool that exists.</p><p><strong>Note</strong>: A lot of what I will write about is in the context of AWS, as this is the system I am most familiar with, although, to a great degree, the same concepts can be applied to any other cloud provider.</p><p>After Amazon came out and said they are moving away from the serverless technology for their Prime service, many people thought that serverless was bad in a way and wouldn’t do a good job. The fact that Amazon decided to change its architecture and not use serverless in this specific service, doesn’t mean in the slightest that serverless wouldn’t do a good job in another case, another company, scale, etc.</p><p>When it comes to a startup, prototype, or system that can benefit from distribution, or PoC for example in my opinion the flexibility that a serverless and distributed architecture can prove is really valuable. You will not be forced to think about scaling and handling servers, while you can focus on the software solution you are building. Usually when required the cloud platform can scale your whole serverless infrastructure automatically so it would answer the increasing demand. In addition, you will not be forced to pay for capacity you do not need or are currently not using, for example, you had a standby VM, that you are paying for, but for some reason you not getting frequent enough traffic to justify it.</p><p>Serverless is not a one size fits all type of solution, its really not that great in many cases such as, but not limited to:</p><ul><li>API development</li><li>Running jobs that will require time to finish — batch jobs, processing, etc.</li><li>Tightly coupled systems</li></ul><h3>Cold start</h3><p>There are several reasons why you wouldn’t generally want to go with serverless in these cases. Let’s start with the problem of the cold start. If you want to build an API, you will need for example an API gateway and Lambda (in the case of AWS) functions to take care of the logic. However, when the function was not invoked for some time, it starts to “sleep”, awaiting new requests. When the request finally arrives it takes some time for the cloud provider to prep the environment and dependencies for example. Which is definitely going to cause slow API responses in some cases. There are ways to mitigate this, but they almost always involve some cost. In most cases, traditional monoliths or microservices will be the way to go for APIs.</p><h3>Invocation duration costs</h3><p>Serverless functions are typically billed not only for invocation counts but for the duration of the processing, thus potentially increasing the cost significantly if the request takes time to process.</p><p>Additionally, it’s quite possible for the performance to suffer in these cases.</p><h3>Cloud provider binding</h3><p>Also let’s not forget, choosing to implement a serverless structure gets you stuck with a specific cloud services provider, which on the cons side can mean that you are less flexible in the future in case you need to change the architecture or the provider. Not to mention that, if the provider decides to change some of the prices and conditions for the services you will be using, this will directly impact your business.</p><h3>Good use cases</h3><p>However, if these concerns don’t mean much to you, you can benefit from a distributed or event-driven structure, you want to save from capacity costs when you start your business/project or you can make use of some asynchronous processing in your architecture (even if only a part of your system) I believe serverless can be of use to you.</p><h3>Integrations</h3><p>One of the best selling points to serverless is how the individual services can be easily integrated with each other. For example, uploading a file to S3 can trigger an automatic process in a serverless function and do some operations. In the same way, you can work with NoSql db (DynamoDb in particular), different streams of data, scheduled events to run jobs, asynchronous processing services such as SNS (Notification service) and SQS (Queue service), and many many others.</p><h3>CDK and Infrastructure as code</h3><p>It is really easy to deal with all of this infrastructure, which at first can be really intimidating, with a tool like AWS cloud development kit, and its derivatives like SST. With them, you can use code to define and configure all of the infrastructure you need, alongside the logic for the Lambda functions for example.</p><h3>Serverless Workflows</h3><p>Although I wanted to make this my main point, I decided to only graze the surface with what I intend to use automated serverless workflows for and go over some of the most suitable use cases.</p><p>With serverless workflows, or AWS Step functions in particular, you can automate different flows in your business, having the configuration you set up for the flow runs the entire logic.</p><figure><img alt="AWS Step functions workflows with Lambda" src="https://cdn-images-1.medium.com/max/1024/1*78wLBs6BTvKDw06iC7btbQ.png" /></figure><p>With step functions, you can:</p><ul><li>Set up a sequence of lambda functions run in order, one after the other to perform some sort of processing on your behalf</li><li>Add SNS events and run the flow only when an event is received</li><li>Add logic branching based on parameters, for example, if you want to have a parameter in the request, where based on it being above a threshold you will route the request to a specific lambda, and in reverse, use another lambda if it does not meet the threshold</li><li>Introduce manual action to the workflow by requiring human interaction to confirm an event for the state machine to continue</li><li>A parallel process to run different operations on the load at the same time</li></ul><p>There are many more functionalities to the step functions, than what I just listed. Traditionally you can create your own workflow inside your software, by implementing the state machine design pattern, achieving a good part of what this service provides. However, with the amount of inter-service integrations that are provided, flexible scalability, and relative ease of use there are definitely reasons for you to pick serverless workflows for your project.</p><p>I am just starting a new open-source project where I can showcase some of this functionality, and within a few weeks, I will be able to share some code. What I will do is create an automated pipeline for candidate profile prequalification (It’s just a test project). I want when a new candidate profile is entered into the system, based on a set of parameters, to potentially discard applications that are not a good match or return a candidate score.</p><p>For example:</p><ol><li>There will be a branching logic if the candidate doesn’t speak English, the profile can be discarded</li><li>If the candidate is lacking a predefined amount of experience, we can require manual confirmation to continue the process.</li><li>When the candidate is moved to the interview process, automatically send an email to them, and the interviewer</li><li>Score the candidate based on checks we can implement with parallel processing</li></ol><p>And many others.</p><p>This is going to be my use case of this technology, there are many others, where serverless workflow management can really excel like ML, Data processing, and different processing pipelines, but I will not get into them, as they are a separate matter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=814ee9d32e51" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>