Kafka quotas are integral to multi-tenant Kafka clusters. They stop Kafka cluster efficiency from being negatively affected by poorly behaved functions overconsuming cluster assets. Moreover, they permit the central streaming knowledge platform to be operated as a multi-tenant platform and utilized by downstream and upstream functions throughout a number of enterprise traces. Kafka helps two kinds of quotas: community bandwidth quotas and request price quotas. Community bandwidth quotas outline byte-rate thresholds similar to how a lot knowledge shopper functions can produce to and eat from every particular person dealer in a Kafka cluster measured in bytes per second. Request price quotas restrict the share of time every particular person dealer spends processing shopper functions requests. Relying in your configuration, Kafka quotas might be set for particular customers, particular shopper IDs, or each.
In Half 1 of this two-part sequence, we mentioned the ideas of the way to implement Kafka quotas in Amazon Managed Streaming for Apache Kafka (Amazon MSK) clusters whereas utilizing AWS Id and Entry Administration (IAM) entry management.
On this put up, we stroll you thru the step-by-step implementation of organising Kafka quotas in an MSK cluster whereas utilizing IAM entry management and testing them by way of pattern shopper functions.
Answer overview
The next determine, which we first launched in Half 1, illustrates how Kafka shopper functions (ProducerApp-1, ConsumerApp-1, and ConsumerApp-2) entry Subject-B within the MSK cluster by assuming write and browse IAM roles. Every producer and client shopper software has a quota that determines how a lot knowledge they’ll produce or eat in bytes/second. The ProducerApp-1 quota permits it to supply as much as 1024 bytes/second per dealer. Equally, the ConsumerApp-1 and ConsumerApp-2 quotas enable them to eat 5120 and 1024 bytes/second per dealer, respectively. The next is a short rationalization of the move proven within the structure diagram:
- P1 –
ProducerApp-1(by way of itsProducerApp-1-FunctionIAM position) assumes theSubject-B-Write-FunctionIAM position to ship messages toSubject-B - P2 – With the
Subject-B-Write-FunctionIAM position assumed,ProducerApp-1begins sending messages toSubject-B - C1 –
ConsumerApp-1(by way of itsConsumerApp-1-FunctionIAM position) andConsumerApp-2(by way of itsConsumerApp-2-FunctionIAM position) assume theSubject-B-Learn-FunctionIAM position to learn messages fromSubject-B - C2 – With the
Subject-B-Learn-FunctionIAM position assumed,ConsumerApp-1andConsumerApp-2begin consuming messages fromSubject-B

Observe that this put up makes use of the AWS Command Line Interface (AWS CLI), AWS CloudFormation templates, and the AWS Administration Console for provisioning and modifying AWS assets, and assets provisioned shall be billed to your AWS account.
The high-level steps are as follows:
- Provision an MSK cluster with IAM entry management and Amazon Elastic Compute Cloud (Amazon EC2) situations for shopper functions.
- Create
Subject-Bon the MSK cluster. - Create IAM roles for the shopper functions to entry
Subject-B. - Run the producer and client functions with out setting quotas.
- Configure the produce and eat quotas for the shopper functions.
- Rerun the functions after setting the quotas.
Stipulations
It is suggested that you just learn Half 1 of this sequence earlier than persevering with. With a purpose to get began, you want the next:
- An AWS account that shall be known as the demo account on this put up, assuming that its account ID is
1111 1111 1111 - Permissions to create, delete, and modify AWS assets within the demo account
Provision an MSK cluster with IAM entry management and EC2 situations
This step entails provisioning an MSK cluster with IAM entry management in a VPC within the demo account. Moreover, we create 4 EC2 situations to make configuration adjustments to the MSK cluster and host producer and client shopper functions.
Deploy CloudFormation stack
- Clone the GitHub repository to obtain the CloudFormation template information and pattern shopper functions:
- On the AWS CloudFormation console, select Stacks within the navigation pane.
- Select Create stack.
- For Put together template, choose Template is prepared.
- For Template supply, choose Add a template file.
- Add the
cfn-msk-stack-1.yamlfile fromamazon-msk-kafka-quotas/cfn-templateslisting, then select Subsequent. - For Stack title, enter
MSKStack. - Depart the parameters as default and select Subsequent.
- Scroll to the underside of the Configure stack choices web page and select Subsequent to proceed.
- Scroll to the underside of the Evaluation web page, choose the examine field I acknowledge that CloudFormation could create IAM assets, and select Submit.
It would take roughly half-hour for the stack to finish. After the stack has been efficiently created, the next assets shall be created:
- A VPC with three personal subnets and one public subnet
- An MSK cluster with three brokers with IAM entry management enabled
- An EC2 occasion referred to as
MSKAdminInstancefor modifying MSK cluster settings in addition to creating and modifying AWS assets - EC2 situations for
ProducerApp-1,ConsumerApp-1, andConsumerApp-2, one for every shopper software - A separate IAM position for every EC2 occasion that hosts the shopper software, as proven within the structure diagram
- From the stack’s Outputs tab, be aware the
MSKClusterArnworth.
Create a subject on the MSK cluster
To create Subject-B on the MSK cluster, full the next steps:
- On the Amazon EC2 console, navigate to your record of working EC2 situations.
- Choose the
MSKAdminInstanceEC2 occasion and select Join. - On the Session Supervisor tab, select Join.
- Run the next instructions on the brand new tab that opens in your browser:
- Set the surroundings variable to level to the MSK Cluster brokers IAM endpoint:
- Pay attention to the worth of
BOOTSTRAP_BROKERS_IAM. - Run the next Kafka CLI command to create
Subject-Bon the MSK cluster:
As a result of the MSK cluster is provisioned with IAM entry management, the choice --command-config factors to config_iam.properties, which incorporates the properties required for IAM entry management, created by the MSKStack CloudFormation stack.
The next warnings could seem while you run the Kafka CLI instructions, however it’s possible you’ll ignore them:
- To confirm that
Subject-Bhas been created, record all of the subjects:
Create IAM roles for shopper functions to entry Subject-B
This step entails creating Subject-B-Write-Function and Subject-B-Learn-Function as proven within the structure diagram. Subject-B-Write-Function allows write operations on Subject-B, and might be assumed by the ProducerApp-1 . In the same means, the ConsumerApp-1 and ConsumerApp-2 can assume Subject-B-Learn-Function to carry out learn operations on Subject-B. To carry out learn operations on Subject-B, ConsumerApp-1 and ConsumerApp-2 should additionally belong to the patron teams specified through the MSKStack stack replace within the subsequent step.
Create the roles with the next steps:
- On the AWS CloudFormation console, select Stacks within the navigation pane.
- Choose
MSKStackand select Replace. - For Put together template, choose Change present template.
- For Template supply, choose Add a template file.
- Add the
cfn-msk-stack-2.yamlfile fromamazon-msk-kafka-quotas/cfn-templateslisting, then select Subsequent. - Present the next extra stack parameters:
-
- For Subject B ARN, enter the
Subject-BARN.
- For Subject B ARN, enter the
The ARN should be formatted as arn:aws:kafka:area:account-id:matter/msk-cluster-name/msk-cluster-uuid/Subject-B. Use the cluster title and cluster UUID from the MSK cluster ARN you famous earlier and supply your AWS Area. For extra data, seek advice from the IAM entry management for Amazon MSK.
-
- For ConsumerApp-1 Client Group title, enter
ConsumerApp-1client group ARN.
- For ConsumerApp-1 Client Group title, enter
It should be formatted as arn:aws:kafka:area:account-id:group/msk-cluster-name/msk-cluster-uuid/consumer-group-name
-
- For ConsumerApp-2 Client Group title, enter
ConsumerApp-2client group ARN.
- For ConsumerApp-2 Client Group title, enter
Use the same format because the earlier ARN.
- Select Subsequent to proceed.
- Scroll to the underside of the Configure stack choices web page and select Subsequent to proceed.
- Scroll to the underside of the Evaluation web page, choose the examine field I acknowledge that CloudFormation could create IAM assets, and select Replace stack.
It would take roughly 3 minutes for the stack to replace. After the stack has been efficiently up to date, the next assets shall be created:
- Subject-B-Write-Function – An IAM position with permission to carry out write operations on
Subject-B. Its belief coverage permits theProducerApp-1-FunctionIAM position to imagine it. - Subject-B-Learn-Function – An IAM position with permission to carry out learn operations on
Subject-B. Its belief coverage permits theConsumerApp-1-FunctionandConsumerApp-2-FunctionIAM roles to imagine it. Moreover,ConsumerApp-1andConsumerApp-2should additionally belong to the patron teams you specified when updating the stack to carry out learn operations onSubject-B.
- From the stack’s Outputs tab, be aware the
TopicBReadRoleARNandTopicBWriteRoleARNvalues.
Run the producer and client functions with out setting quotas
Right here, we run ProducerApp-1, ConsumerApp-1, and ConsumerApp-2 with out setting their quotas. From the earlier steps, you’ll need BOOTSTRAP_BROKERS_IAM worth, Subject-B-Write-Function ARN, and Subject-B-Learn-Function ARN. The supply code of shopper functions and their packaged variations can be found within the GitHub repository.
Run the ConsumerApp-1 software
To run the ConsumerApp-1 software, full the next steps:
- On the Amazon EC2 console, choose the
ConsumerApp-1EC2 occasion and select Join. - On the Session Supervisor tab, select Join.
- Run the next instructions on the brand new tab that opens in your browser:
- Run the
ConsumerApp-1software to begin consuming messages fromSubject-B:
You could find the supply code on GitHub to your reference. The command line parameter particulars are as follows:
- –bootstrap-servers – MSK cluster bootstrap brokers IAM endpoint.
- –assume-role-arn –
Subject-B-Learn-FunctionIAM position ARN. Assuming this position,ConsumerApp-1will learn messages from the subject. - –area – Area you’re utilizing.
- –topic-name – Subject title from which
ConsumerApp-1will learn messages. The default isSubject-B. - –consumer-group – Client group title for
ConsumerApp-1, as specified through the stack replace. - –role-session-name –
ConsumerApp-1assumes theSubject-B-Learn-Functionutilizing the AWS Safety Token Service (AWS STS) SDK.ConsumerApp-1will use this position session title when calling theassumeRoleoperate. - –client-id – Shopper ID for
ConsumerApp-1. - –print-consumer-quota-metrics – Flag indicating whether or not shopper metrics ought to be printed on the terminal by
ConsumerApp-1. - –cw-dimension-name – Amazon CloudWatch dimension title that shall be used to publish shopper throttling metrics from
ConsumerApp-1. - –cw-dimension-value – CloudWatch dimension worth that shall be used to publish shopper throttling metrics from
ConsumerApp-1. - –cw-namespace – Namespace the place
ConsumerApp-1will publish CloudWatch metrics in an effort to monitor throttling.
- Should you’re glad with the remainder of parameters, use the next command and alter
--assume-role-arnand--regionas per your surroundings:

The fetch-throttle-time-avg and fetch-throttle-time-max shopper metrics ought to show 0.0, indicating no throttling is going on for ConsumerApp-1. Keep in mind that we haven’t set the eat quota for ConsumerApp-1 but. Let it run for some time.
Run the ConsumerApp-2 software
To run the ConsumerApp-2 software, full the next steps:
- On the Amazon EC2 console, choose the
ConsumerApp-2EC2 occasion and select Join. - On the Session Supervisor tab, select Join.
- Run the next instructions on the brand new tab that opens in your browser:
- Run the
ConsumerApp-2software to begin consuming messages fromSubject-B:
The code has related command line parameters particulars as ConsumerApp-1 mentioned beforehand, aside from the next:
- –consumer-group – Client group title for
ConsumerApp-2, as specified through the stack replace. - –role-session-name –
ConsumerApp-2assumes theSubject-B-Learn-Functionutilizing the AWS STS SDK.ConsumerApp-2will use this position session title when calling theassumeRoleoperate. - –client-id – Shopper ID for
ConsumerApp-2.
- Should you’re glad with the remainder of parameters, use the next command and alter
--assume-role-arnand--regionas per your surroundings:

The fetch-throttle-time-avg and fetch-throttle-time-max shopper metrics ought to show 0.0, indicating no throttling is going on for ConsumerApp-2. Keep in mind that we haven’t set the eat quota for ConsumerApp-2 but. Let it run for some time.
Run the ProducerApp-1 software
To run the ProducerApp-1 software, full the next steps:
- On the Amazon EC2 console, choose the
ProducerApp-1EC2 occasion and select Join. - On the Session Supervisor tab, select Join.
- Run the next instructions on the brand new tab that opens in your browser:
- Run the
ProducerApp-1software to begin sending messages toSubject-B:
You could find the supply code on GitHub to your reference. The command line parameter particulars are as follows:
- –bootstrap-servers – MSK cluster bootstrap brokers IAM endpoint.
- –assume-role-arn –
Subject-B-Write-FunctionIAM position ARN. Assuming this position,ProducerApp-1will write messages to the subject. - –topic-name –
ProducerApp-1will ship messages to this matter. The default isSubject-B. - –area – AWS Area you’re utilizing.
- –num-messages – Variety of messages the
ProducerApp-1software will ship to the subject. - –role-session-name –
ProducerApp-1assumes theSubject-B-Write-Functionutilizing the AWS STS SDK.ProducerApp-1will use this position session title when calling theassumeRoleoperate. - –client-id – Shopper ID of
ProducerApp-1. - –producer-type –
ProducerApp-1might be run both synchronously or asynchronously. Choices are sync or async. - –print-producer-quota-metrics – Flag indicating whether or not the shopper metrics ought to be printed on the terminal by ProducerApp-1.
- –cw-dimension-name – CloudWatch dimension title that shall be used to publish shopper throttling metrics from ProducerApp-1.
- –cw-dimension-value – CloudWatch dimension worth that shall be used to publish shopper throttling metrics from ProducerApp-1.
- –cw-namespace – The namespace the place ProducerApp-1 will publish CloudWatch metrics in an effort to monitor throttling.
- Should you’re glad with the remainder of parameters, use the next command and alter
--assume-role-arnand--regionas per your surroundings. To run a synchronous Kafka producer, it makes use of the choice--producer-type sync:
Alternatively, use --producer-type async to run an asynchronous producer. For extra particulars, seek advice from Asynchronous ship.
The produce-throttle-time-avg and produce-throttle-time-max shopper metrics ought to show 0.0, indicating no throttling is going on for ProducerApp-1. Keep in mind that we haven’t set the produce quota for ProducerApp-1 but. Verify that ConsumerApp-1 and ConsumerApp-2 can eat messages and see they aren’t throttled. Cease the patron and producer shopper functions by urgent Ctrl+C of their respective browser tabs.
Set produce and eat quotas for shopper functions
Now that we now have run the producer and client functions with out quotas, we set their quotas and rerun them.
Open the Classes Supervisor terminal for the MSKAdminInstance EC2 occasion as described earlier and run the next instructions to search out the default configuration of one of many brokers within the MSK cluster. MSK clusters are provisioned with the default Kafka quotas configuration.

The next screenshot exhibits the Dealer-1 default values for quota.client.default and quota.producer.default.
ProducerApp-1 quota configuration
Change placeholders in all of the instructions on this part with values that correspond to your account.
In keeping with the structure diagram mentioned earlier, set the ProducerApp-1 produce quota to 1024 bytes/second. For <ProducerApp-1 Shopper Id> and <ProducerApp-1 Function Session>, be sure to use the identical values that you just used whereas working ProducerApp-1 earlier (producerapp-1-client-id and producerapp-1-role-session, respectively):

Confirm the ProducerApp-1 produce quota utilizing the next command:

You may take away the ProducerApp-1 produce quota through the use of the next command, however don’t run the command as we’ll take a look at the quotas subsequent.

ConsumerApp-1 quota configuration
Change placeholders in all of the instructions on this part with values that correspond to your account.
Let’s set a eat quota of 5120 bytes/second for ConsumerApp-1. For <ConsumerApp-1 Shopper Id> and <ConsumerApp-1 Function Session>, be sure to use the identical values that you just used whereas working ConsumerApp-1 earlier (consumerapp-1-client-id and consumerapp-1-role-session, respectively):
kafka-configs.sh --bootstrap-server $BOOTSTRAP_BROKERS_IAM
--command-config config_iam.properties
--alter --add-config 'consumer_byte_rate=5120'
--entity-type shoppers --entity-name <ConsumerApp-1 Shopper Id>
--entity-type customers --entity-name arn:aws:sts::<AWS Account Id>:assumed-role/MSKStack-TopicBReadRole-xxxxxxxxxxx/<ConsumerApp-1 Function Session>
Confirm the ConsumerApp-1 eat quota utilizing the next command:
You may take away the ConsumerApp-1 eat quota, through the use of the next command, however don’t run the command as we’ll take a look at the quotas subsequent.
ConsumerApp-2 quota configuration
Change placeholders in all of the instructions on this part with values that correspond to your account.
Let’s set a eat quota of 1024 bytes/second for ConsumerApp-2. For <ConsumerApp-2 Shopper Id> and <ConsumerApp-2 Function Session>, be sure to use the identical values that you just used whereas working ConsumerApp-2 earlier (consumerapp-2-client-id and consumerapp-2-role-session, respectively):
Confirm the ConsumerApp-2 eat quota utilizing the next command:
As with ConsumerApp-1, you possibly can take away the ConsumerApp-2 eat quota utilizing the identical command with ConsumerApp-2 shopper and consumer particulars.
Rerun the producer and client functions after setting quotas
Let’s rerun the functions to confirm the impact of the quotas.
Rerun ProducerApp-1
Rerun ProducerApp-1 in synchronous mode with the identical command that you just used earlier. The next screenshot illustrates that when ProducerApp-1 reaches its quota on any of the brokers, the produce-throttle-time-avg and produce-throttle-time-max shopper metrics worth shall be above 0.0. A price above 0.0 signifies that ProducerApp-1 is throttled. Enable ProducerApp-1 to run for a couple of seconds after which cease it through the use of Ctrl+C.

You may as well take a look at the impact of the produce quota by rerunning ProducerApp-1 once more in asynchronous mode (--producer-type async). Just like a synchronous run, the next screenshot illustrates that when ProducerApp-1 reaches its quota on any of the brokers, the produce-throttle-time-avg and produce-throttle-time-max shopper metrics worth shall be above 0.0. A price above 0.0 signifies that ProducerApp-1 is throttled. Enable asynchronous ProducerApp-1 to run for some time.

You’ll finally see a TimeoutException stating org.apache.kafka.widespread.errors.TimeoutException: Expiring xxxxx file(s) for Subject-B-2:xxxxxxx ms has handed since batch creation

When utilizing an asynchronous producer and sending messages at a price higher than the dealer can settle for because of the quota, the messages shall be queued within the shopper software reminiscence first. The shopper will finally run out of buffer area if the speed of sending messages continues to exceed the speed of accepting messages, inflicting the subsequent Producer.ship() name to be blocked. Producer.ship() will finally throw a TimeoutException if the timeout delay shouldn’t be adequate to permit the dealer to catch as much as the producer software. Cease ProducerApp-1 through the use of Ctrl+C.
Rerun ConsumerApp-1
Rerun ConsumerApp-1 with the identical command that you just used earlier. The next screenshot illustrates that when ConsumerApp-1 reaches its quota, the fetch-throttle-time-avg and fetch-throttle-time-max shopper metrics worth shall be above 0.0. A price above 0.0 signifies that ConsumerApp-1 is throttled.

Enable ConsumerApp-1 to run for a couple of seconds after which cease it through the use of Ctrl+C.
Rerun ConsumerApp-2
Rerun ConsumerApp-2 with the identical command that you just used earlier. Equally, when ConsumerApp-2 reaches its quota, the fetch-throttle-time-avg and fetch-throttle-time-max shopper metrics worth shall be above 0.0. A price above 0.0 signifies that ConsumerApp-2 is throttled. Enable ConsumerApp-2 to run for a couple of seconds after which cease it by urgent Ctrl+C.
Shopper quota metrics in Amazon CloudWatch
In Half 1, we defined that shopper metrics are metrics uncovered by shoppers connecting to Kafka clusters. Let’s study the shopper metrics in CloudWatch.
- On the CloudWatch console, select All metrics.
- Underneath Customized Namespaces, select the namespace you offered whereas working the shopper functions.
- Select the dimension title and choose
produce-throttle-time-max,produce-throttle-time-avg,fetch-throttle-time-max, andfetch-throttle-time-avg metricsfor all of the functions.
These metrics point out throttling habits for ProducerApp-1, ConsumerApp-1, and ConsumerApp-2 functions examined with the quota configurations within the earlier part. The next screenshots point out the throttling of ProducerApp-1, ConsumerApp-1, and ConsumerApp-2 primarily based on community bandwidth quotas. ProducerApp-1, ConsumerApp-1, and ConsumerApp-2 functions feed their respective shopper metrics to CloudWatch. You could find the supply code on GitHub to your reference.


Safe shopper ID and position session title
We mentioned the way to configure Kafka quotas utilizing an software’s shopper ID and authenticated consumer principal. When a shopper software assumes an IAM position to entry Kafka subjects on a MSK cluster with IAM authentication enabled, its authenticated consumer principal is represented within the following format (for extra data, seek advice from IAM identifiers):
arn:aws:sts::111111111111:assumed-role/Subject-B-Write-Function/producerapp-1-role-session
It incorporates the position session title (on this case, producerapp-1-role-session) used within the shopper software whereas assuming an IAM position by way of the AWS STS SDK. The shopper software supply code is out there to your reference. The shopper ID is a logical title string (for instance, producerapp-1-client-id) that’s configured within the software code by the applying staff. Due to this fact, an software can impersonate one other software if it obtains the shopper ID and position session title of the opposite software, and if it has permission to imagine the identical IAM position.
As proven within the structure diagram, ConsumerApp-1 and ConsumerApp-2 are two separate shopper functions with their respective quota allocations. As a result of each have permission to imagine the identical IAM position (Subject-B-Learn-Function) within the demo account, they’re allowed to eat messages from Subject-B. Thus, MSK cluster brokers distinguish them primarily based on their shopper IDs and customers (which comprise their respective position session title values). If ConsumerApp-2 by some means obtains the ConsumerApp-1 position session title and shopper ID, it might probably impersonate ConsumerApp-1 by specifying the ConsumerApp-1 position session title and shopper ID within the software code.
Let’s assume ConsumerApp-1 makes use of consumerapp-1-client-id and consumerapp-1-role-session as its shopper ID and position session title, respectively. Due to this fact, ConsumerApp-1's authenticated consumer principal will seem as follows when it assumes the Subject-B-Learn-Function IAM position:
arn:aws:sts::<AWS Account Id>:assumed-role/Subject-B-Learn-Function/consumerapp-1-role-session
Equally, ConsumerApp-2 makes use of consumerapp-2-client-id and consumerapp-2-role-session as its shopper ID and position session title, respectively. Due to this fact, ConsumerApp-2's authenticated consumer principal will seem as follows when it assumes the Subject-B-Learn-Function IAM position:
arn:aws:sts::<AWS Account Id>:assumed-role/Subject-B-Learn-Function/consumerapp-2-role-session
If ConsumerApp-2 obtains ConsumerApp-1's shopper ID and position session title and specifies them in its software code, MSK cluster brokers will deal with it as ConsumerApp-1 and think about its shopper ID as consumerapp-1-client-id, and the authenticated consumer principal as follows:
arn:aws:sts::<AWS Account Id>:assumed-role/Subject-B-Learn-Function/consumerapp-1-role-session
This enables ConsumerApp-2 to eat knowledge from the MSK cluster at a most price of 5120 bytes per second quite than 1024 bytes per second as per its unique quota allocation. Consequently, ConsumerApp-1's throughput shall be negatively impacted if ConsumerApp-2 runs concurrently.
Enhanced structure
You may introduce AWS Secrets and techniques Supervisor and AWS Key Administration Service (AWS KMS) within the structure to safe functions’ shopper IDs and position session names. To offer stronger governance, the functions’ shopper ID and position session title should be saved as encrypted secrets and techniques within the Secrets and techniques Supervisor. The IAM useful resource insurance policies related to encrypted secrets and techniques and a KMS buyer managed key (CMK) will enable functions to entry and decrypt solely their respective shopper ID and position session title. On this means, functions won’t be able to entry one another’s shopper ID and position session title and impersonate each other. The next picture exhibits the improved structure.

The up to date move has the next levels:
- P1 –
ProducerApp-1retrieves itsclient-idandrole-session-namesecrets and techniques from Secrets and techniques Supervisor - P2 –
ProducerApp-1configures the keyclient-idasCLIENT_ID_CONFIGwithin the software code, and assumesSubject-B-Write-Function(by way of itsProducerApp-1-FunctionIAM position) by passing the keyrole-session-nameto the AWS STS SDKassumeRoleoperate name - P3 – With the
Subject-B-Write-FunctionIAM position assumed,ProducerApp-1begins sending messages toSubject-B - C1 –
ConsumerApp-1andConsumerApp-2retrieve their respectiveclient-idandrole-session-namesecrets and techniques from Secrets and techniques Supervisor - C2 –
ConsumerApp-1andConsumerApp-2configure their respective secretclient-idasCLIENT_ID_CONFIGof their software code, and assumeSubject-B-Write-Function(by way ofConsumerApp-1-FunctionandConsumerApp-2-FunctionIAM roles, respectively) by passing their secretrole-session-namewithin the AWS STS SDKassumeRoleoperate name - C3 – With the
Subject-B-Learn-FunctionIAM position assumed,ConsumerApp-1andConsumerApp-2begin consuming messages fromSubject-B
Discuss with the documentation for AWS Secrets and techniques Supervisor and AWS KMS to get a greater understanding of how they match into the structure.
Clear up assets
Navigate to the CloudFormation console and delete the MSKStack stack. All assets created throughout this put up shall be deleted.
Conclusion
On this put up, we lined detailed steps to configure Amazon MSK quotas and demonstrated their impact by way of pattern shopper functions. As well as, we mentioned how you should use shopper metrics to find out if a shopper software is throttled. We additionally highlighted a possible situation with plaintext shopper IDs and position session names. We advocate implementing Kafka quotas with Amazon MSK utilizing Secrets and techniques Supervisor and AWS KMS as per the revised structure diagram to make sure a zero-trust structure.
When you’ve got suggestions or questions on this put up, together with the revised structure, we’d be comfortable to listen to from you. We hope you loved studying this put up.
In regards to the Writer
Vikas Bajaj is a Senior Supervisor, Options Architects, Monetary Providers at Amazon Internet Providers. With over 20 years of expertise in monetary companies and dealing with digital-native companies, he advises clients on product design, know-how roadmaps, and software architectures.
