Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 730343e

Browse files
author
Jon Wayne Parrott
committed
Updating compute engine sample to use image families. Fixes GoogleCloudPlatform#276 (GoogleCloudPlatform#341)
1 parent a3d36ed commit 730343e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compute/api/create_instance.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ def list_instances(compute, project, zone):
4242

4343
# [START create_instance]
4444
def create_instance(compute, project, zone, name, bucket):
45-
source_disk_image = \
46-
"projects/debian-cloud/global/images/debian-7-wheezy-v20150320"
45+
# Get the latest Debian Jessie image.
46+
image_response = compute.images().getFromFamily(
47+
project='debian-cloud', family='debian-8').execute()
48+
source_disk_image = image_response['selfLink']
49+
50+
# Configure the machine
4751
machine_type = "zones/%s/machineTypes/n1-standard-1" % zone
4852
startup_script = open(
4953
os.path.join(

0 commit comments

Comments
 (0)