DEV Community

ant Kenworthy
ant Kenworthy

Posted on

2 3

Packer: Using an image family from another project

Following on from my previous post: Packer: Building images on Google Cloud You should now be able to build compute images on GCP and you may have used this to build a pre-configured image you can effortlessly deploy again and again without having to wait to install software.

You may now want to use that image, or someone else's image from a different project as a starting point for your web or database server.

If you do you, can add the following line to your packer template in the builders section to specify another project to source your image from:

source_image_project_id
Enter fullscreen mode Exit fullscreen mode

Here's how that may look when used in your packer template:

{
  "builders": [
    {
      "type": "googlecompute",
      "project_id": "my project",
      "zone": "us-central1-a",
      "source_image_family": "base-image-linux",
      "source_image_project_id":, "example-project",
      "ssh_username": "packer",
      "image_name": "packer-{{timestamp}}",
      "image_family": "socks-web"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Here the base-image-linux may contain our companies standard logging setup and common utilities. From this you could then install your web server or database utilities on top of that common image.

Another example may be to use the public images provided by a regulatory body where you need to add some helper scripts before you deploy it to your project.

🎉

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay