User guide

Table Of Contents
Create an Amazon SQS Client
You will 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 on credentials and
profiles, see Configuring Your AWS SDK for .NET Application (p. 8).
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="AWSProfileName" value="my_profile"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
After you create this file, you are ready to create and initialize your Amazon SQS client.
To create and initialize an Amazon SQS client
1. Create and initialize an AmazonSQSConfig instance, and set the ServiceURL property with the protocol
and service endpoint, as follows:
AmazonSQSConfig amazonSQSConfig =
new AmazonSQSConfig();
amazonSQSConfig.ServiceURL =
"http://sqs.us-west-2.amazonaws.com";
The AWS SDK for .NET uses US East (N.Virginia) Region as the default region if you do not specify
a region in your code. However, the AWS Management Console uses US West (Oregon) Region as
its default. Therefore, when using the AWS Management Console in conjunction with your develop-
ment, be sure to specify the same region in both your code and the console.
Go to Regions and Endpoints for the current list of regions and corresponding endpoints for each of
the services offered by AWS.
2. Use the AmazonSQSConfig instance to create and initialize an AmazonSQSClient instance, as follows:
amazonSQSClient =
new AmazonSQSClient(amazonSQSConfig);
You can now use the client to create an Amazon SQS queue. For information about creating a queue,
see Create an Amazon SQS Queue (p. 59).
Create an Amazon SQS Queue
You can use the AWS SDK for .NET to programmatically create an Amazon SQS queue. Creating an
Amazon SQS Queue is an administrative task.You can create a queue by using the AWS Management
Console instead of creating a queue programmatically.
Version v2.0.0
59
AWS SDK for .NET Developer Guide
Create an Amazon SQS Client