0
0
AWScloud~10 mins

Dead letter queues in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the dead letter queue ARN in the AWS SQS queue configuration.

AWS
QueueUrl = sqs.create_queue(QueueName='MyQueue', Attributes={'RedrivePolicy': '{"deadLetterTargetArn":"[1]"}'})
Drag options to blanks, or click blank then click option'
Aarn:aws:sqs:us-east-1:123456789012:MyDeadLetterQueue
Barn:aws:s3:::mybucket
Carn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0
Darn:aws:lambda:us-east-1:123456789012:function:MyFunction
Attempts:
3 left
💡 Hint
Common Mistakes
Using an ARN for a different AWS service like S3 or Lambda.
Not providing the ARN in the RedrivePolicy attribute.
2fill in blank
medium

Complete the code to set the maximum receive count before moving messages to the dead letter queue.

AWS
RedrivePolicy = '{"maxReceiveCount": [1], "deadLetterTargetArn": "arn:aws:sqs:us-east-1:123456789012:MyDeadLetterQueue"}'
Drag options to blanks, or click blank then click option'
A100
B0
C5
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting maxReceiveCount to zero or negative numbers.
Using a very high number that defeats the purpose of dead letter queues.
3fill in blank
hard

Fix the error in the RedrivePolicy JSON string to correctly configure the dead letter queue.

AWS
RedrivePolicy = '{"maxReceiveCount": 3, "deadLetterTargetArn": [1]'
Drag options to blanks, or click blank then click option'
Aarn:aws:s3:::mybucket
Barn:aws:sqs:us-east-1:123456789012:MyDeadLetterQueue
C'arn:aws:sqs:us-east-1:123456789012:MyDeadLetterQueue'
D"arn:aws:sqs:us-east-1:123456789012:MyDeadLetterQueue"
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the ARN string inside the JSON.
Using single quotes instead of double quotes inside JSON.
4fill in blank
hard

Fill both blanks to create a dead letter queue and attach it to the main queue.

AWS
dlq_url = sqs.create_queue(QueueName='DeadLetterQueue')
dlq_arn = sqs.get_queue_attributes(QueueUrl=dlq_url, AttributeNames=['[1]'])['Attributes']['[2]']
Drag options to blanks, or click blank then click option'
AQueueArn
BQueueUrl
CArn
DUrl
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Arn' instead of 'QueueArn' as attribute name.
Confusing QueueUrl and QueueArn in parameters.
5fill in blank
hard

Fill all three blanks to configure the main queue with a dead letter queue and max receive count.

AWS
dlq_arn = '[1]'
redrive_policy = '{"maxReceiveCount": [2], "deadLetterTargetArn": "[3]"}'
main_queue_url = sqs.create_queue(QueueName='MainQueue', Attributes={'RedrivePolicy': redrive_policy})
Drag options to blanks, or click blank then click option'
Aarn:aws:sqs:us-east-1:123456789012:DeadLetterQueue
B5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up ARN strings and variables.
Using inconsistent ARN values between variables and policy.