AWS API: Proper syntax for filtering by tag name and value (e.g. describeInstanc...
source link: https://blog.jakubholy.net/2015/06/11/aws-api-proper-syntax-for-filtering-by-tag-e-g-describeinstances/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
AWS API: Proper syntax for filtering by tag name and value (e.g. describeInstances)
The documentation is not exactly crystal-clear to me:
Anyway, here is the proper syntax, provided we are interested in the tag elasticbeanstalk:environment-name:
tag
:key=value - The key/value combination of a tag assigned to the resource, wheretag
:key is the tag's key.
var params = {
Filters: [
{
Name: 'tag:elasticbeanstalk:environment-name',
Values: ['mySuperApp']
}
]
};
ec2.describeInstances(params);
So the name of the tag is embedded in the Name part and not, as I initially understood,
{ Name: 'tag', Values: ['elasticbeanstalk:environment-name=mySuperApp'] }
Credit: garnaat.
Are you benefitting from my writing? Consider buying me a coffee or supporting my work via GitHub Sponsors. Thank you! You can also book me for a mentoring / pair-programming session via Codementor or (cheaper) email.
Allow me to write to you!
Let's get in touch! I will occasionally send you a short email with a few links to interesting stuff I found and with summaries of my new blog posts. Max 1-2 emails per month. I read and answer to all replies.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK