I have the following queue that is getting created with the serverless.yml file of Serverless Framework project:
resources:
Resources:
myAppSQSQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "my-app-sqs-queue-${opt:stage, self:provider.stage}"
How do I take URL of the queue that gets created and store it as a parameter in AWS Systems Manager? I need to store it there so other applications outside of this one know how to access it.
I figured it out. Since serverless framework extends CloudFormation, I found the answer in the Cloud Formation documenation here:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html
It can be done as follows:
resources:
Resources:
myAppSQSQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "my-app-sqs-queue-${opt:stage, self:provider.stage}"
myAppSSMParameterQueueName:
Type: AWS::SSM::Parameter
Properties:
Name: /${opt:stage, self:provider.stage}/sqs/my-app-param-name
Type: String
Value:
Fn::GetAtt:
- myAppSQSQueue
- Arn
Tags:
Environment: ${opt:stage, self:provider.stage}
This stores the ARN of the queue in the parameter store. I'm not sure if getting the url is possible, but the ARN is fine for my use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With