Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add image builder scripts #541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/app-stream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Overview

This package allows you to initialize an AppStream Image Builder


# Development

Please refer [here](./SETUP.md##launching-an-appstream-image-builder-instance)
38 changes: 38 additions & 0 deletions scripts/app-stream/SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Overview

This following guide will show you how to set up an AppStream image with the following applications installed: Firefox, Notepad, PuttyGen, and Putty.

### High Level Overview
1. We launch an AppStream Image Builder instance.
2. We log into the AppStream Image builder instance and run a script to build an image with Firefox, PuttyGen, Putty, and Notepad.


### Launching an AppStream Image Builder instance
1. Navigate to `scripts/app-stream` directory
2. Run the following commands
```
npm install
npm run start-image-builder -- <AWS Profile> <region> <Base image name> <instance size>
# Example: npm run start-image-builder -- default us-east-1 AppStream-WinServer2019-06-01-2021 stream.standard.medium
# If preferred you can choose the default base image name and instance size by running this command: npm run start-image-builder -- default us-east-1 default default
```
Note: Please set up your [AWS Profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) beforehand so that you have permission to launch an AppStream image builder instance in your AWS Account.
3. Once the Image Builder is launched and ready, click on the URL provided in the terminal console. This will take you to the AppStream page on the AWS Console.

### Building AppStream Image
![Image Builder Screenshot](./screenshots/ImageBuilderSelector.png)
1. On the AppStream page in AWS console, select the AppStream image that was built in the previous step and click Connect.
2. This will open a new tab in your browser. When the prompt ask for which user you would like to log in as, choose Administrator. This will take you to a Windows Desktop that you can interact with to create your AppStream image.
3. On the Windows desktop, click the `Start` button and type in `Windows Powershell`. Right click the application in the search result, and choose `Run as administrator`
4. Run the following commands
```
cd ~\Documents

# Pull the Image Builder script from Github
Invoke-WebRequest -Uri https://raw.githubusercontent.com/awslabs/service-workbench-on-aws/image-builder-scripts/scripts/app-stream/buildImage.ps1 -OutFile buildImage.ps1

# Execute Image builder script
.\buildImage.ps1
```

5. At this point the Image builder will build your image and you'll see a "Failed to reserve a session" modal. This is expected. Log back into AppStream on the AWS Console and wait till the AppStream image is built.
20 changes: 20 additions & 0 deletions scripts/app-stream/buildImage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Install Putty using Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

choco install -y putty.install

# Add Applications

cd "C:\Program Files\Amazon\Photon\ConsoleImageBuilder"

.\image-assistant.exe add-application --absolute-app-path "C:\Program Files\PuTTY\putty.exe" --display-name Putty --name Putty

.\image-assistant.exe add-application --absolute-app-path "C:\Program Files\PuTTY\puttygen.exe" --display-name PuttyGen --name PuttyGen

.\image-assistant.exe add-application --absolute-app-path "C:\Windows\System32\notepad.exe" --display-name Notepad --name Notepad

.\image-assistant.exe add-application --absolute-app-path "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" --display-name Firefox --name Firefox

# Create App
$ImageName="FirefoxPuttyNotepad_" + $(Get-Date -Format "MM-dd-yyyy-hh-mm-ss")
.\image-assistant.exe create-image --name $ImageName
Loading