Challenge - 5 Problems
Amazon MSK Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Kafka consumer configuration?
Consider the following Kafka consumer configuration snippet for Amazon MSK. What will be the output when the consumer tries to read messages from a topic that does not exist?
Kafka
Properties props = new Properties(); props.put("bootstrap.servers", "b-1.mskcluster.example.com:9092,b-2.mskcluster.example.com:9092"); props.put("group.id", "test-group"); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props); consumer.subscribe(Collections.singletonList("nonexistent-topic")); ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(5)); System.out.println("Number of records: " + records.count());
Attempts:
2 left
💡 Hint
Think about how Kafka handles subscriptions to topics that do not exist yet.
✗ Incorrect
When a Kafka consumer subscribes to a topic that does not exist, it does not throw an error immediately. Instead, it waits and polls, returning zero records until the topic is created.
🧠 Conceptual
intermediate1:30remaining
Which Amazon MSK feature ensures data durability across multiple availability zones?
Amazon MSK is designed to be highly available and durable. Which feature primarily ensures that your Kafka data is safe even if one availability zone fails?
Attempts:
2 left
💡 Hint
Think about how Kafka replicates data to avoid data loss.
✗ Incorrect
Kafka topics have a replication factor that determines how many copies of each partition exist across brokers in different availability zones, ensuring durability.
🔧 Debug
advanced2:30remaining
Why does this Kafka producer fail to send messages to Amazon MSK?
Examine the following Kafka producer code snippet. It fails to send messages to the MSK cluster. What is the most likely cause?
Kafka
Properties props = new Properties(); props.put("bootstrap.servers", "b-1.mskcluster.example.com:9092"); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); KafkaProducer<String, String> producer = new KafkaProducer<>(props); ProducerRecord<String, String> record = new ProducerRecord<>("my-topic", "key1", "value1"); producer.send(record); producer.close();
Attempts:
2 left
💡 Hint
Amazon MSK clusters often require authentication settings in the client configuration.
✗ Incorrect
If the MSK cluster is configured with SASL/SCRAM authentication, the producer must include the proper security settings to connect and send messages.
📝 Syntax
advanced1:30remaining
Identify the syntax error in this Kafka topic creation command for Amazon MSK.
Which option contains the correct syntax to create a Kafka topic named 'orders' with 3 partitions and a replication factor of 2 using kafka-topics.sh CLI?
Attempts:
2 left
💡 Hint
Check the exact option names and their spelling for partitions and replication factor.
✗ Incorrect
The correct flags are --partitions and --replication-factor without equals signs. The topic name must follow the --topic flag.
🚀 Application
expert3:00remaining
How to configure an Amazon MSK cluster for encryption in transit and at rest?
You want to secure your Amazon MSK cluster so that all data is encrypted both when moving between clients and brokers, and when stored on disk. Which configuration steps are required?
Attempts:
2 left
💡 Hint
Think about both network encryption and storage encryption options in MSK.
✗ Incorrect
Encryption in transit is achieved by enabling TLS on the MSK cluster and clients. Encryption at rest is done by enabling AWS KMS encryption on the EBS volumes used by the brokers.