How to get JobQueue and JobDefinition name in Cloudformation template
up vote
1
down vote
favorite
In a Cloudformation template, how can I can I get a Batch::JobDefinition and Batch::JobQueue name, so I can pass them into a Lambda as a variable?
I have tried pulling it out with !GetAtt using JobQueueName name QueueName but it all fails on updating the stack. Using !Ref only gives me the arn, which I can't use in the JS SDK to communicate with the batch processing.
amazon-web-services aws-sdk amazon-cloudformation
add a comment |
up vote
1
down vote
favorite
In a Cloudformation template, how can I can I get a Batch::JobDefinition and Batch::JobQueue name, so I can pass them into a Lambda as a variable?
I have tried pulling it out with !GetAtt using JobQueueName name QueueName but it all fails on updating the stack. Using !Ref only gives me the arn, which I can't use in the JS SDK to communicate with the batch processing.
amazon-web-services aws-sdk amazon-cloudformation
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In a Cloudformation template, how can I can I get a Batch::JobDefinition and Batch::JobQueue name, so I can pass them into a Lambda as a variable?
I have tried pulling it out with !GetAtt using JobQueueName name QueueName but it all fails on updating the stack. Using !Ref only gives me the arn, which I can't use in the JS SDK to communicate with the batch processing.
amazon-web-services aws-sdk amazon-cloudformation
In a Cloudformation template, how can I can I get a Batch::JobDefinition and Batch::JobQueue name, so I can pass them into a Lambda as a variable?
I have tried pulling it out with !GetAtt using JobQueueName name QueueName but it all fails on updating the stack. Using !Ref only gives me the arn, which I can't use in the JS SDK to communicate with the batch processing.
amazon-web-services aws-sdk amazon-cloudformation
amazon-web-services aws-sdk amazon-cloudformation
asked Nov 9 at 10:18
OnIIcE
337215
337215
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Both resources, AWS::Batch::JobQueue and AWS::Batch::JobDefinition, only have the function Ref enabled to return the arn, you can't get any other value of those resources. What you can do is to use the function Fn::Split and Fn::Select to obtain their names based on the arn. For example,
For the JobQueue, with arn
arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority, this code will returnHighPriority.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobQueue]]]
For the JobDefinition, with arn
arn:aws:batch:us-east-1:111122223333:job-definition/test-gpu:2, this code will returntest-gpu.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobDefinition]]]
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Both resources, AWS::Batch::JobQueue and AWS::Batch::JobDefinition, only have the function Ref enabled to return the arn, you can't get any other value of those resources. What you can do is to use the function Fn::Split and Fn::Select to obtain their names based on the arn. For example,
For the JobQueue, with arn
arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority, this code will returnHighPriority.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobQueue]]]
For the JobDefinition, with arn
arn:aws:batch:us-east-1:111122223333:job-definition/test-gpu:2, this code will returntest-gpu.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobDefinition]]]
add a comment |
up vote
1
down vote
Both resources, AWS::Batch::JobQueue and AWS::Batch::JobDefinition, only have the function Ref enabled to return the arn, you can't get any other value of those resources. What you can do is to use the function Fn::Split and Fn::Select to obtain their names based on the arn. For example,
For the JobQueue, with arn
arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority, this code will returnHighPriority.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobQueue]]]
For the JobDefinition, with arn
arn:aws:batch:us-east-1:111122223333:job-definition/test-gpu:2, this code will returntest-gpu.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobDefinition]]]
add a comment |
up vote
1
down vote
up vote
1
down vote
Both resources, AWS::Batch::JobQueue and AWS::Batch::JobDefinition, only have the function Ref enabled to return the arn, you can't get any other value of those resources. What you can do is to use the function Fn::Split and Fn::Select to obtain their names based on the arn. For example,
For the JobQueue, with arn
arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority, this code will returnHighPriority.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobQueue]]]
For the JobDefinition, with arn
arn:aws:batch:us-east-1:111122223333:job-definition/test-gpu:2, this code will returntest-gpu.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobDefinition]]]
Both resources, AWS::Batch::JobQueue and AWS::Batch::JobDefinition, only have the function Ref enabled to return the arn, you can't get any other value of those resources. What you can do is to use the function Fn::Split and Fn::Select to obtain their names based on the arn. For example,
For the JobQueue, with arn
arn:aws:batch:us-east-1:111122223333:job-queue/HighPriority, this code will returnHighPriority.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobQueue]]]
For the JobDefinition, with arn
arn:aws:batch:us-east-1:111122223333:job-definition/test-gpu:2, this code will returntest-gpu.
!Select [1 , !Split ["/", !Select [5, !Split [":", !Ref JobDefinition]]]
edited Nov 11 at 12:09
Walery Strauch
3,67963448
3,67963448
answered Nov 10 at 20:57
Aura Herrera
215
215
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53223831%2fhow-to-get-jobqueue-and-jobdefinition-name-in-cloudformation-template%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown