As others have pointed out, adding more details will help in getting better answers. Nevertheless, assuming that you are creating an SQS using the below template,
myQueueLogicalId:
Type: AWS::SQS::Queue
Properties:
QueueName: myQueue
VisibilityTimeout: 4200
MessageRetentionPeriod: 1209600
you can get the queue name (or if you want the full url or ARN change the attribute as given in the sqs cloudformation documentation) to your lambda function by passing it in the environment variable as below:
myFunctionLogicalId:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
MY_SQS: !GetAtt
- myQueueLogicalId
- QueueName
FunctionName: myFunction
Handler: src/handlers/handler
Runtime: nodejs14.x
Timeout: 650
MemorySize: 4096
This parameter can be retrieved in your code as mentioned here.