
Deploy SAML 2.0 Authentication for AWS EUC Services in Minutes with CloudFormation
SAML 2.0 authentication for AWS End-User Computing (EUC) services like Amazon AppStream 2.0 or Amazon WorkSpaces can be tricky, with even small typos leading to deployment failures. This article demonstrates how to leverage AWS CloudFormation to streamline and error-proof the AWS-side SAML 2.0 integration process. Learn how to automate your setup, minimize configuration errors, and simplify your deployment workflow for more reliable and efficient EUC service authentication.
Sergio Volpi
Amazon Employee
Published May 27, 2025
Last Modified Jun 3, 2025
This CloudFormation template creates a SAML federation setup for AWS End-User Computing services (either AppStream 2.0 or WorkSpaces Personal or Pools).
EnvType
: Lets you choose between AppStream 2.0 or WorkSpaces PersonalFederationName
: Name for your SAML provider in IAMFederationBucket
andFederationFile
: S3 location of your identity provider's metadata XML file- Service-specific parameters:
AppStreamStackName
for AppStream, orWorkSpacesDirectoryID
andUserAccessUrl
for WorkSpaces (Personal or Pools)
CreateWSResources
: True when WorkSpaces Personal is selectedCreateASResources
: True when AppStream 2.0 is selected
The AWS CloudFormation template will deploy the following resources:
- FederatedRole: An IAM role that:
- Can be assumed via SAML federation
- Has permissions to either stream AppStream or WorkSpaces based on the selected environment
- Uses the SAML subject as the user identifier for authorization
- LambdaExecutionRole: IAM role for Lambda functions with permissions to:
- Create/delete SAML providers
- Access S3 to read the metadata file
- Modify WorkSpaces SAML properties
- Write logs to CloudWatch
- ModifySamlPropertiesLambda (only for WorkSpaces):
- Python function that configures SAML integration for WorkSpaces
- Enables SAML authentication and sets the user access URL
- Handles CloudFormation custom resource lifecycle events
- ModifySamlProperties: Custom CloudFormation resource that invokes the Lambda function
- SAMLProviderLambda:
- Python function that manages the IAM SAML provider
- Downloads the metadata file from S3
- Creates/updates/deletes the SAML provider based on CloudFormation events
- Includes proper error handling and response sending
- SAMLProvider: Custom CloudFormation resource that invokes the Lambda function to create the actual IAM SAML provider
Before deploying the AWS CloudFormation described in this blogpost, you must to configure your Identity Provider (IdP) Custom SAML 2.0 Application and depending on your IdP, you might need to manually update your IdP to trust AWS as a service provider. You do this by downloading the
saml-metadata.xml
file found at https://signin.aws.amazon.com/static/saml-metadata.xml, and then uploading it to your IdP. To configure SAML-based Identity Provider (IdP) for:Before executing the CloudFormation template, you must upload your IdP metadata.xml and the template example (check AWS CloudFormation Template Example section) to the bucket created for this purpose.
Now you need to execute the CloudFormation to start deploying the required resources.
Once the AWS CloudFormation stack finishes:
- Access CloudFormation Outputs
- Record Output Values
- Depending on your IdP, you must manually update your IdP's Role assertion (https://aws.amazon.com/SAML/Attributes/Role) with the Record Output Values from previous step in the following format: [FederatedRoleArn,SAMLProviderArn]
This template uses a combination of native CloudFormation resources and custom resources (via AWS Lambda) to set up a complete SAML federation for either AppStream 2.0 or WorkSpaces, allowing users to access these services through their identity provider.
This section provides structured procedures for validating SAML 2.0 integration deployed with this solution for AWS WorkSpaces and AppStream 2.0.
- AppStream 2.0 Client Installation
- Download and install the Amazon AppStream client from https://clients.amazonappstream.com
- Set the StartURL Registry with your IdP
UserAccessUrl
. Link
- Application Launch
- Open your AppStream 2.0 Client
- AppStream 2.0 Client will redirect to your IdP to authenticate
- Click on the application tile you want to launch
- Confirm the "Launch Application" prompt appears
- WorkSpaces Client Installation
- Download and install the Amazon WorkSpaces client from https://clients.amazonworkspaces.com/
- Enter the registration code of your WorkSpaces deployment
- Desktop Launch
- Open your WorkSpaces Client
- The client will redirect to your IdP to authenticate
- Return to your WorkSpaces Client
- Confirm the desktop launched
This section provides a systematic instructions to safely remove all AWS resources created by the SAML 2.0 CloudFormation stack. The cleanup process ensures proper removal of resources while maintaining data integrity and preventing unintended service disruptions.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.