I am new to AWS. I quickly run AWS tutorials. I followed the AWS code and sqs documentation.
This is the following code I wrote
import boto3
from boto3.session import Session
session = Session(aws_access_key_id="aswe343ffsf34r3fef3f",
aws_secret_access_key="3423d23r2fwwfe232r2r",
region_name="ap-southeast-1")
sqs = session.resource("sqs")
q_client = boto3.client("sqs")
sqs.create_queue(QueueName='test-One',
Attributes = {'DelaySeconds': '5'
})
sqs.create_queue(QueueName='test-Three',
Attributes = {'DelaySeconds': '5' })
q_client.create_queue(QueueName='test-Two',Attributes = {
"DelaySeconds" : "5"
})
q = q_client.list_queues()
print "QUEUE - URLS ",q.get("QueueUrls")
qList = sqs.queues.all()
for q in qList:
print q.url
Output above code
(env1)rahul@ubuntu:~/rahul/PythonPractise/Boto3_Practise$ python clientTwo.py
QUEUE - URLS ['https://us-west-2.queue.amazonaws.com/978916941101/test-Two']
https://ap-southeast-1.queue.amazonaws.com/978916941101/test
https://ap-southeast-1.queue.amazonaws.com/978916941101/test-1
https://ap-southeast-1.queue.amazonaws.com/978916941101/test-One
https://ap-southeast-1.queue.amazonaws.com/978916941101/test-Three
(env1)rahul@ubuntu:~/rahul/PythonPractise/Boto3_Practise$
My question is:
why the queue Client cannot display the queues created from the "resource" and why the resource does not list the queues created from the client.
when i do
(env1)rahul@ubuntu:~/rahul/PythonPractise/Boto3_Practise$ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************ef3f shared-credentials-file
secret_key ****************2r2r shared-credentials-file
region us-west-2 config-file ~/.aws/config
Is it due to areas?
source
share