Terraform snippets

    This codecreates an Amazon EC2 AMI. The most_recent attribute is set to true, meaning the AMI will be the most recent one. The executable_users attribute includes a list of users who are allowed to run the AMI. The filter attributes specify which AWS resources the AMI can use. The owners attribute specifies the user who created the AMI.

    Shortcut: tf_aws_ami

    data "aws_ami" "${ami-name}" {
      most_recent = true
      executable_users = ["self"]
      filter {
        name = "owner-alias"
        values = ["amazon"]
      filter {
        name = "name"
        values = ["amzn-ami-vpc-nat*"]
      owners = ["self"]
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.