Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何确定SQS队列是手动创建的还是使用CF模板创建的?_Python_Amazon Web Services_Aws Cli_Amazon Cloudformation - Fatal编程技术网

Python 如何确定SQS队列是手动创建的还是使用CF模板创建的?

Python 如何确定SQS队列是手动创建的还是使用CF模板创建的?,python,amazon-web-services,aws-cli,amazon-cloudformation,Python,Amazon Web Services,Aws Cli,Amazon Cloudformation,我尝试了以下内容,但它没有给我任何CF模板ID或任何允许我查找的描述 示例: aws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --attribute-names All* { "Attributes": { "ApproximateNumberOfMessagesNotVisible": "0", "RedrivePolicy"

我尝试了以下内容,但它没有给我任何CF模板ID或任何允许我查找的描述

示例:

aws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --attribute-names All*
{
  "Attributes": {
    "ApproximateNumberOfMessagesNotVisible": "0",
    "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:us-east-1:80398EXAMPLE:MyDeadLetterQueue\",\"maxReceiveCount\":1000}",
    "MessageRetentionPeriod": "345600",
    "ApproximateNumberOfMessagesDelayed": "0",

 "MaximumMessageSize": "262144",
    "CreatedTimestamp": "1442426968",
    "ApproximateNumberOfMessages": "0",
    "ReceiveMessageWaitTimeSeconds": "0",
    "DelaySeconds": "0",
    "VisibilityTimeout": "30",
    "LastModifiedTimestamp": "1442426968",
    "QueueArn": "arn:aws:sqs:us-east-1:80398EXAMPLE:MyNewQueue"
  }
}
输出:

aws sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --attribute-names All*
{
  "Attributes": {
    "ApproximateNumberOfMessagesNotVisible": "0",
    "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:us-east-1:80398EXAMPLE:MyDeadLetterQueue\",\"maxReceiveCount\":1000}",
    "MessageRetentionPeriod": "345600",
    "ApproximateNumberOfMessagesDelayed": "0",

 "MaximumMessageSize": "262144",
    "CreatedTimestamp": "1442426968",
    "ApproximateNumberOfMessages": "0",
    "ReceiveMessageWaitTimeSeconds": "0",
    "DelaySeconds": "0",
    "VisibilityTimeout": "30",
    "LastModifiedTimestamp": "1442426968",
    "QueueArn": "arn:aws:sqs:us-east-1:80398EXAMPLE:MyNewQueue"
  }
}

通过将队列URL(即)作为参数传递给,可以确定SQS队列是否是CloudFormation堆栈的一部分

使用AWS CLI命令,您需要使用
--CLI input json[json_file]
传递参数,因为直接提供
--physical resource id
参数时将尝试解析队列URL

例如:

aws cloudformation describe-stack-resources --cli-input-json '{"PhysicalResourceId": "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue"}'
如果队列是堆栈的一部分,那么将返回堆栈资源的列表。如果没有,则将返回一个
验证错误