2019-01-23 23:29:50 +00:00
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
2018-10-11 14:17:57 -07:00
// ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at
// https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/sqs-examples-using-queues.html
2019-01-23 23:29:50 +00:00
// snippet-start:[sqs.JavaScript.queues.createQueue]
2018-10-11 14:17:57 -07:00
// Load the AWS SDK for Node.js
var AWS = require ( "aws-sdk" ) ;
// Set the region
AWS . config . update ( { region : "REGION" } ) ;
2019-01-23 23:29:50 +00:00
// Create an SQS service object
2018-10-11 14:17:57 -07:00
var sqs = new AWS . SQS ( { apiVersion : "2012-11-05" } ) ;
var params = {
2019-01-23 23:29:50 +00:00
QueueName : "SQS_QUEUE_NAME" ,
2018-10-11 14:17:57 -07:00
Attributes : {
DelaySeconds : "60" ,
MessageRetentionPeriod : "86400" ,
} ,
} ;
sqs . createQueue ( params , function ( err , data ) {
if ( err ) {
console . log ( "Error" , err ) ;
} else {
console . log ( "Success" , data . QueueUrl ) ;
}
} ) ;
2019-01-23 23:29:50 +00:00
// snippet-end:[sqs.JavaScript.queues.createQueue]