Create and Specify Session Scripts
You can configure and specify session scripts for Always-on, On-demand, and Elastic fleets.
To configure and specify session scripts for Always-on and On-demand fleets
Open the AppStream 2.0 console at https://console.aws.amazon.com/appstream2
. -
In the navigation pane, choose Images, Image Builder.
-
Choose an image builder that is in the Running state, and choose Connect.
-
When prompted, choose Administrator.
-
Navigate to
C:\AppStream\SessionScripts
, and open theconfig.json
configuration file.For information about session script parameters, see Session Scripts Configuration File.
-
After you finish making your changes, save and close the
config.json
file. -
On the image builder desktop, open Image Assistant.
-
(Optional) Specify any additional applications that you want to include in the image.
-
Follow the necessary steps in Image Assistant to finish creating your image.
If the session scripts configuration can't be validated (for example, if the .json file is not correctly formatted), you are notified when you choose Disconnect and create image.
Note
To locate the session scripts configuration file for Linux-based image builders, navigate to
/opt/appstream/SessionScripts/config.json
.
To configure and specify session scripts for Elastic fleets
-
Create a zip file that contains the session scripts and config.json file. The scripts files will be copied to the following locations. You must use these locations for your config.json.
-
For Windows, use
C:\AppStream\SessionScripts\
.SessionScript
-
For Linux, use
/opt/appstream/SessionScripts/
.SessionScript
Note
In order to run the session script files, make sure that the .zip file only contains the session scripts and
config.json
files, and not the containing folder. For more information, see Session Scripts Configuration File. -
-
Upload the zip file to an Amazon S3 bucket in your account.
Note
Your VPC must provide access to the Amazon S3 bucket. For more information, see Using Amazon S3 VPC Endpoints for AppStream 2.0 Features.
You must have your S3 bucket and AppStream 2.0 fleet in the same AWS Region.
You must have IAM permissions to perform the
S3:GetObject
action on the session scripts object in the Amazon S3 bucket. To learn more about storing the session scripts in an Amazon S3 bucket, see Store Application Icon, Setup Script, Session Script, and VHD in an S3 Bucket. Open the AppStream 2.0 console at https://console.aws.amazon.com/appstream2
. -
In the navigation pane, choose Fleets.
-
Choose an Elastic fleet that you want to update, and then choose View Details.
-
On the Session scripts settings tab, choose Edit.
-
For Session scripts object in S3, either enter the S3 URI that represents the session scripts object, or choose Browse S3 to navigate to your S3 buckets and find the session scripts object.
-
After you finish making your changes, choose Save Changes.
-
At this point, session scripts are available for all fleet instances launched.
Note
You can also configure the session scripts when you create a new Elastic fleet.