AWS SDK for .NET
Developer Guide

Creating an Amazon SQS Client

You need an Amazon SQS client in order to create and use an Amazon SQS queue. Before configuring your client, you should create an App.Config file to specify your AWS credentials.

You specify your credentials by referencing the appropriate profile in the appSettings section of the file.

The following example specifies a profile named my_profile. For more information about credentials and profiles, see Configuring Your AWS SDK for .NET Application.

<?xml version="1.0"?> <configuration> <configSections> <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/> </configSections> <aws profileName="my_profile"/> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>

After you create this file, you're ready to create and initialize your Amazon SQS client.

To create and initialize an Amazon SQS client

You can now use the client to create an Amazon SQS queue. For information about creating a queue, see Creating an Amazon SQS Queue.

  1. Create and initialize an AmazonSQSConfig instance, and then set the ServiceURL property with the protocol and service endpoint, as follows.

    var sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = "http://sqs.us-west-2.amazonaws.com";
  2. Use the AmazonSQSConfig instance to create and initialize an AmazonSQSClient instance, as follows.

    var sqsClient = new AmazonSQSClient(sqsConfig);