[{"data":1,"prerenderedAt":408},["ShallowReactive",2],{"$f1e2tuszqjpgz1":3},{"title":4,"date":5,"tags":6,"categories":9,"_id":10,"slug":11,"path":12,"document":13,"excerpt":406,"readingTimeMinutes":407},"Exploring the Digital Ocean `doctl` Utility","2023-01-01T00:00:00.000Z",[7,8],"linux","digital-ocean",[7],"content:blog:doctl","doctl","\u002Fblog\u002Fdoctl",{"frontmatter":14,"meta":15,"nodes":16},{},{},[17,30,34,43,91,102,123,126,167,170,222,229,256,263,288,291,364,367,383,403],[18,19,20,21,24,25,29],"p",{},"I recently had the need to spool up a small ephemeral Linux instance, and wanted to try something new by exploring the Digital Ocean ",[22,23,11],"code",{}," command line utility.\nThis proved to be an ",[26,27,28],"em",{},"extremely"," easy way to configure, create, connect, and destroy a Linux box, and I foresee myself using this service even more in the future.",[31,32,33],null,{},"more",[18,35,36,37,42],{},"To start things off, I had to install and setup authentication to Digital Ocean. Doing\nthis on my Mac machine, I opted to use ",[38,39,41],"a",{"href":40},"https:\u002F\u002Fbrew.sh\u002F","Homebrew",".",[44,45,48],"pre",{"language":46,"class":47},"sh","shiki shiki-themes tokyo-night dark:tokyo-night",[22,49,51,60,61,60,74,60,76,60,81],{"class":50},"language-sh",[52,53,56],"span",{"class":54,"style":55},"line","display: inline",[52,57,59],{"style":58},"color:#51597D;--shiki-light-font-style:italic","# install `doctl`","\n",[52,62,63,67,71],{"class":54,"style":55},[52,64,66],{"style":65},"color:#C0CAF5","brew",[52,68,70],{"style":69},"color:#9ECE6A"," install",[52,72,73],{"style":69}," doctl",[52,75],{"class":54,"style":55},[52,77,78],{"class":54,"style":55},[52,79,80],{"style":58},"# setup authentication",[52,82,83,85,88],{"class":54,"style":55},[52,84,11],{"style":65},[52,86,87],{"style":69}," auth",[52,89,90],{"style":69}," init",[18,92,93,94,98,99,42],{},"While the online ",[38,95,97],{"href":96},"https:\u002F\u002Fdocs.digitalocean.com\u002Freference\u002Fdoctl\u002Freference\u002Fcompute\u002Fdroplet\u002Fcreate\u002F","documentation"," is fantastic, I instead found myself mostly referencing the outputs of ",[22,100,101],{},"--help",[44,103,104],{"language":46,"class":47},[22,105,106],{"class":50},[52,107,108,110,113,116,119],{"class":54,"style":55},[52,109,11],{"style":65},[52,111,112],{"style":69}," compute",[52,114,115],{"style":69}," droplet",[52,117,118],{"style":69}," create",[52,120,122],{"style":121},"color:#E0AF68"," --help",[18,124,125],{},"I had to find the image name of the version of Ubuntu I wanted to install:",[44,127,128],{"language":46,"class":47},[22,129,130,60,155,60,157,60,162],{"class":50},[52,131,132,134,136,139,142,145,149,152],{"class":54,"style":55},[52,133,11],{"style":65},[52,135,112],{"style":69},[52,137,138],{"style":69}," image",[52,140,141],{"style":69}," list",[52,143,144],{"style":121}," --public",[52,146,148],{"style":147},"color:#89DDFF"," |",[52,150,151],{"style":65}," grep",[52,153,154],{"style":69}," ubuntu-22",[52,156],{"class":54,"style":55},[52,158,159],{"class":54,"style":55},[52,160,161],{"style":58},"# 118857366    22.04 (LTS) x64    snapshot    Ubuntu    ubuntu-22-04-x64    true    7",[52,163,164],{"class":54,"style":55},[52,165,166],{"style":58},"# 119383150    22.10 x64          snapshot    Ubuntu    ubuntu-22-10-x64    true    7",[18,168,169],{},"And also the slug of the compute size:",[44,171,172],{"language":46,"class":47},[22,173,174,60,185,60,187,60,192,60,197,60,202,60,207,60,212,60,217],{"class":50},[52,175,176,178,180,183],{"class":54,"style":55},[52,177,11],{"style":65},[52,179,112],{"style":69},[52,181,182],{"style":69}," size",[52,184,141],{"style":69},[52,186],{"class":54,"style":55},[52,188,189],{"class":54,"style":55},[52,190,191],{"style":58},"# Slug                  Description    Memory    VCPUs    Disk    Price Monthly    Price Hourly",[52,193,194],{"class":54,"style":55},[52,195,196],{"style":58},"# s-1vcpu-512mb-10gb    Basic          512       1        10      4.00             0.005950",[52,198,199],{"class":54,"style":55},[52,200,201],{"style":58},"# s-1vcpu-1gb           Basic          1024      1        25      6.00             0.008930",[52,203,204],{"class":54,"style":55},[52,205,206],{"style":58},"# s-1vcpu-1gb-amd       Basic AMD      1024      1        25      7.00             0.010420",[52,208,209],{"class":54,"style":55},[52,210,211],{"style":58},"# s-1vcpu-1gb-intel     Basic Intel    1024      1        25      7.00             0.010420",[52,213,214],{"class":54,"style":55},[52,215,216],{"style":58},"# s-1vcpu-2gb           Basic          2048      1        50      12.00            0.017860",[52,218,219],{"class":54,"style":55},[52,220,221],{"style":58},"# s-1vcpu-2gb-amd       Basic AMD      2048      1        50      14.00            0.020830",[18,223,224,225,228],{},"I've also configured a few SSH keys with Digital Ocean, and I can have the key (specified by ID) provisioned to the machine using the ",[22,226,227],{},"--ssh-keys"," flag.",[44,230,231],{"language":46,"class":47},[22,232,233,60,244,60,246,60,251],{"class":50},[52,234,235,237,239,242],{"class":54,"style":55},[52,236,11],{"style":65},[52,238,112],{"style":69},[52,240,241],{"style":69}," ssh-key",[52,243,141],{"style":69},[52,245],{"class":54,"style":55},[52,247,248],{"class":54,"style":55},[52,249,250],{"style":58},"# ID      Name    FingerPrint",[52,252,253],{"class":54,"style":55},[52,254,255],{"style":58},"# 1234    mini    \u003Credacted>",[18,257,258,259,262],{},"Also, I wanted to install a few packages to the box upon creation, this can be done easily with the ",[22,260,261],{},"--user-data-file"," flag to run an initialization script.",[44,264,265],{"language":46,"class":47},[22,266,267],{"class":50},[52,268,269,273,276,279,282,285],{"class":54,"style":55},[52,270,272],{"style":271},"color:#0DB9D7","echo",[52,274,275],{"style":147}," '",[52,277,278],{"style":69},"apt install -y imagemagick zip",[52,280,281],{"style":147},"'",[52,283,284],{"style":147}," >",[52,286,287],{"style":69}," bootstrap.sh",[18,289,290],{},"Putting it all together, here is the simple command for creating a small compute instance!",[44,292,293],{"language":46,"class":47},[22,294,295,60,308,60,318,60,328,60,338,60,349,60,359],{"class":50},[52,296,297,299,301,303,305],{"class":54,"style":55},[52,298,11],{"style":65},[52,300,112],{"style":69},[52,302,115],{"style":69},[52,304,118],{"style":69},[52,306,307],{"style":147}," \\",[52,309,310,313,316],{"class":54,"style":55},[52,311,312],{"style":121},"    --image",[52,314,315],{"style":69}," ubuntu-22-10-x64",[52,317,307],{"style":147},[52,319,320,323,326],{"class":54,"style":55},[52,321,322],{"style":121},"    --size",[52,324,325],{"style":69}," s-1vcpu-512mb-10gb",[52,327,307],{"style":147},[52,329,330,333,336],{"class":54,"style":55},[52,331,332],{"style":121},"    --region",[52,334,335],{"style":69}," nyc1",[52,337,307],{"style":147},[52,339,340,343,347],{"class":54,"style":55},[52,341,342],{"style":121},"    --ssh-keys",[52,344,346],{"style":345},"color:#FF9E64"," 1234",[52,348,307],{"style":147},[52,350,351,354,357],{"class":54,"style":55},[52,352,353],{"style":121},"    --user-data-file",[52,355,356],{"style":69}," boostrap.sh",[52,358,307],{"style":147},[52,360,361],{"class":54,"style":55},[52,362,363],{"style":69},"    ephemeral",[18,365,366],{},"Finally, I can connect, do my thing, and destroy the instance.",[44,368,369],{"language":46,"class":47},[22,370,371],{"class":50},[52,372,373,375,377,380],{"class":54,"style":55},[52,374,11],{"style":65},[52,376,112],{"style":69},[52,378,379],{"style":69}," ssh",[52,381,382],{"style":69}," ephemeral",[44,384,385],{"language":46,"class":47},[22,386,387],{"class":50},[52,388,389,391,393,395,398,401],{"class":54,"style":55},[52,390,11],{"style":65},[52,392,112],{"style":69},[52,394,115],{"style":69},[52,396,397],{"style":69}," delete",[52,399,400],{"style":121}," --force",[52,402,382],{"style":69},[18,404,405],{},"All-in-all, I was up and running in about 20 minutes. What a handy utility!","I recently had the need to spool up a small ephemeral Linux instance, and wanted to try something new by exploring the Digital Ocean doctl command line utility. This proved to be an extremely easy way to configure, create, connect, and destroy a Linux box, and I foresee myself using this service even more in the future.",1,1790648870266]