AWS SDK for .NET
Developer Guide

Creating an Amazon SQS Queue

Creating an Amazon SQS queue is an administrative task that you can do by using the SQS Management Console. However, you can also use the AWS SDK for .NET to programmatically create an Amazon SQS queue.

To create an Amazon SQS queue

For information about how queues work in Amazon SQS, see How SQS Queues Work.

For information about your queue URL, see Constructing Amazon SQS Queue URLs.

  1. Create and initialize a CreateQueueRequest instance. Provide the name of your queue and specify a visibility timeout for your queue messages, as follows.

    var createQueueRequest = new CreateQueueRequest(); createQueueRequest.QueueName = "MySQSQueue"; var attrs = new Dictionary<string, string>(); attrs.Add(QueueAttributeName.VisibilityTimeout, "10"); createQueueRequest.Attributes = attrs;

    Your queue name must be composed of only alphanumeric characters, hyphens, and underscores.

    Any message in the queue remains in the queue unless the specified visibility timeout is exceeded. The default visibility timeout for a queue is 30 seconds. For more information about visibility timeouts, see Visibility Timeout. For more information about different queue attributes you can set, see SetQueueAttributes.

  2. After you create the request, pass it as a parameter to the CreateQueue method. The method returns a CreateQueueResponse object, as follows.

    var createQueueResponse = sqsClient.CreateQueue(createQueueRequest);