Redrive Policy
Allows you to set a redrive policy of an SQS Queue while referencing ARN of the dead letter queue inside the redrive policy. This is useful when you want to set a dedicated dead letter queue for a standard or FIFO queue, but need the dead letter queue to exist before setting the redrive policy.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sqs.Queue;
import com.pulumi.aws.sqs.QueueArgs;
import com.pulumi.aws.sqs.RedrivePolicy;
import com.pulumi.aws.sqs.RedrivePolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var queue = new Queue("queue");
var ddl = new Queue("ddl", QueueArgs.builder()
.redriveAllowPolicy(queue.arn().applyValue(arn -> serializeJson(
jsonObject(
jsonProperty("redrivePermission", "byQueue"),
jsonProperty("sourceQueueArns", jsonArray(arn))
))))
.build());
var redrivePolicy = new RedrivePolicy("redrivePolicy", RedrivePolicyArgs.builder()
.queueUrl(queue.id())
.redrivePolicy(ddl.arn().applyValue(arn -> serializeJson(
jsonObject(
jsonProperty("deadLetterTargetArn", arn),
jsonProperty("maxReceiveCount", 4)
))))
.build());
}
}
Content copied to clipboard
Import
SQS Queue Redrive Policies can be imported using the queue URL, e.g.,
$ pulumi import aws:sqs/redrivePolicy:RedrivePolicy test https://queue.amazonaws.com/0123456789012/myqueue
Content copied to clipboard
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The JSON redrive policy for the SQS queue. Accepts two key/val pairs: deadLetterTargetArn
and maxReceiveCount
. Learn more in the Amazon SQS dead-letter queues documentation.