Posted: Tuesday, January 17, 2023
Word Count: 482
Reading Time: 3 minutes
This article leverages chocolatey to quickly install IaC tools onto a windows based workstation.
The code installs the following tools:
Tools | Information |
---|---|
Visual Studio Code | https://code.visualstudio.com/ |
Azure Command Line Interface | https://learn.microsoft.com/en-us/cli/azure/what-is-azure-cli |
aws cli | https://aws.amazon.com/cli/ |
gcloud cli | https://cloud.google.com/cli |
Powershell 7 | https://learn.microsoft.com/en-us/training/modules/introduction-to-powershell/ |
Terraform | https://www.terraform.io/ |
Chocolatey is a command-line installer for windows software. Similar to apt-get or yum leveraged in Linux-based OSes, It simplifies the process of downloading and installing software.
Chocolatey’s syntax is fairly straightforward. All commands begin with choco, followed by the action, and then the package name.
Choco Action | Description |
---|---|
list | lists remote or local packages |
info | retrieves package information. Shorthand for choco search pkgname |
search | searches remote or local packages (alias for list) |
install | installs packages from various sources |
upgrade | upgrades packages from various sources |
uninstall | uninstalls a package |
Installing chocolatey is very straight-forward and only requires a single line of code.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco --version
With chocolatey installed, tools such as visual studio code, PowerShell 7, and az CLI can quickly be installed. Installing packages begins with the syntax of choco install followed by the name of the package or packages to be installed. Multiple packages can be installed by separating them with a space. Packages can be located by using the choco search command or simply searching the chocolatey. To install the packages listed in the table below, type in the following command:
choco install awscli terraform azure-cli gcloudsdk powershell-core vscode -y
The -y switch is optional and removes the need to confirm the prompts that will pop up during the installation.
Once the script is complete it will provide a list of packages that were successfully installed. The machine may need to be rebooted before using some of the applications.
The script can be catered to your needs by simply removing or adding additional packages. The time of installation will vary depending on the complexity of the application.