{"id":28373684,"url":"https://github.com/plus3it/cfn-look-up-ami-ids","last_synced_at":"2025-06-25T15:31:40.609Z","repository":{"id":70263164,"uuid":"51873203","full_name":"plus3it/cfn-look-up-ami-ids","owner":"plus3it","description":"AWS Lambda blueprint to lookup AMI IDs by AMI Name","archived":false,"fork":false,"pushed_at":"2016-02-16T22:30:27.000Z","size":4,"stargazers_count":3,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-29T20:20:49.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plus3it.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-16T21:53:22.000Z","updated_at":"2021-11-20T13:49:17.000Z","dependencies_parsed_at":"2023-05-03T02:54:58.862Z","dependency_job_id":null,"html_url":"https://github.com/plus3it/cfn-look-up-ami-ids","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plus3it/cfn-look-up-ami-ids","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plus3it%2Fcfn-look-up-ami-ids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plus3it%2Fcfn-look-up-ami-ids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plus3it%2Fcfn-look-up-ami-ids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plus3it%2Fcfn-look-up-ami-ids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plus3it","download_url":"https://codeload.github.com/plus3it/cfn-look-up-ami-ids/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plus3it%2Fcfn-look-up-ami-ids/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261900972,"owners_count":23227483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-29T20:08:41.306Z","updated_at":"2025-06-25T15:31:40.593Z","avatar_url":"https://github.com/plus3it.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cfn-look-up-ami-ids\nAWS Lambda blueprint to lookup AMI IDs by AMI Name\n\nThis blueprint mirrors the blueprint of the same name provide by AWS, with the\nfollowing enhancements:\n\n- Removes the restriction on looking up only AMI IDs owned by Amazon\n- Uses a new parameter, `AmiNameSearchString`, as the match pattern\nagainst AMI Names. Previously, the pattern was hard-coded in the blueprint\n- Improves error logging when the pattern does not match any images\n\n## Lambda Execution Role\n\nBefore creating the Lambda function, first create an IAM role with the\nfollowing policy to use with this blueprint. For convenience, name the role\nsomething like `cfn-look-up-ami-ids`.\n\n```\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"logs:CreateLogGroup\",\n        \"logs:CreateLogStream\",\n        \"logs:PutLogEvents\"\n      ],\n      \"Resource\": \"arn:aws:logs:*:*:*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [ \"ec2:DescribeImages\" ],\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\n## CloudFormation Example Usage\n\nUse a CloudFormation Parameter to define the pattern to match against when\nsearching for the AMI by Name. In the example below, the default value of the\nparameter `AmiNameStringSearch` is set to match the naming pattern Amazon uses\nfor their Windows Server 2012 R2 AMIs.\n\n```\n  \"Parameters\" : {\n    \"AmiNameSearchString\" : {\n        \"Description\" : \"Search pattern to match against an AMI Name\",\n        \"Type\" : \"String\",\n        \"Default\" : \"Windows_Server-2012-R2_RTM-English-64Bit-Base-*\"\n    }\n  }\n```\n\nCall the Lambda function using a custom CloudFormation resource. This resource\nwill return with an attribute named `Id` containing the AMI ID. Use the\nfunction `Fn::GetAtt` to reference this attribute within the `ImageId`\nproperty of the instance (or launch configuration).\n\n```\n  \"Resources\" : {\n    \"AmiIdLookup\": {\n      \"Type\": \"Custom::AmiIdLookup\",\n      \"Properties\": {\n        \"ServiceToken\": {\n          \"Fn::Join\" : [\n            \":\",\n            [\n              \"arn:aws:lambda\",\n              { \"Ref\" : \"AWS::Region\" },\n              { \"Ref\" : \"AWS::AccountId\" },\n              \"function:cfn-look-up-ami-ids\"\n            ]\n          ]\n        },\n        \"Region\": { \"Ref\" : \"AWS::Region\" },\n        \"AmiNameSearchString\": { \"Ref\" : \"AmiNameSearchString\" }\n      }\n    },\n    \"MyInstance\" :\n    {\n      \"Type\" : \"AWS::EC2::Instance\",\n      \"Properties\" : {\n        \"ImageId\": { \"Fn::GetAtt\": [ \"AmiIdLookup\", \"Id\" ] },\n        # ... elided ...\n      }\n    }\n  }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplus3it%2Fcfn-look-up-ami-ids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplus3it%2Fcfn-look-up-ami-ids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplus3it%2Fcfn-look-up-ami-ids/lists"}