Prepare your AWS account
SaaSLayer deploys its services into an AWS account you own. Before your first deployment, you need three things:
- An AWS account.
- Credentials for that account that are allowed to set up the SaaSLayer connection.
- A terminal where the
saaslayerCLI can use those credentials.
Pick the path that fits you:
- New to AWS: create an account, then run everything from AWS CloudShell, a terminal in your browser. You don't install anything on your computer.
- Existing AWS account or a security team:
an administrator creates a narrowly scoped
SaaSLayerBootstrappermission set or role from the copy-paste policies on this page. You then use it from your own terminal.
Both paths end at the same steps: connect the account and run your first dev deployment.
Path A: new to AWS
1. Create and secure the account
- Go to aws.amazon.com and choose Create an AWS Account. You need an email address, a phone number and a payment card. The email and password you choose are the account's root user, which can do anything, including closing the account.
- Turn on MFA for the root user. Sign in as root, open the account menu (your account name, top right) and choose Security credentials. Under Multi-factor authentication (MFA), choose Assign MFA device and follow the steps. An authenticator app is fine.
- Set a budget alert so a surprise bill can't happen quietly. Search the console for Budgets, then choose Create budget. Choose Use a template, then Monthly cost budget. Enter an amount you're comfortable with (for example 20 USD) and your email address, then choose Create budget.
- Note your account ID, a 12-digit number. It's in the account menu (top
right). The SaaSLayer commands below call it
YOUR_AWS_ACCOUNT_ID.
2. Sign in as an administrator, not as root
Don't use the root user day to day. AWS recommends IAM Identity Center for people who sign in:
- Search the console for IAM Identity Center and choose Enable.
- Choose Users, then Add user. Enter your own name and email. AWS emails an invitation; accept it, set a password and register MFA.
- Choose Multi-account permissions, then Permission sets, then Create permission set. Choose Predefined permission set, then AdministratorAccess, and create it.
- Choose Multi-account permissions, then AWS accounts. Select your account and choose Assign users or groups. Pick your user, then the AdministratorAccess permission set, and choose Submit.
- Copy the AWS access portal URL from the IAM Identity Center dashboard. Sign out of the root user, open that URL and sign in as your new user. Choose your account, then AdministratorAccess, to open the console.
An administrator can set up SaaSLayer. If you'd rather give SaaSLayer setup only the permissions it needs, follow path B from here instead.
3. Open AWS CloudShell
In the console, choose the CloudShell icon (>_) in the top bar, or search
for CloudShell. Use the region selector (top right) to pick the region
you'll deploy to, such as US East (N. Virginia) us-east-1.
CloudShell is a terminal that is already signed in as you. It comes with the AWS CLI and Node.js. Check that you're in the intended account, and that Node.js is version 18 or newer:
aws sts get-caller-identity
node --versionAccount in the output must be your account ID. Then install the SaaSLayer CLI.
Only your home directory survives between CloudShell sessions, so install it
there:
npm config set prefix "$HOME/.local"
npm install -g saaslayer
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
export PATH="$HOME/.local/bin:$PATH"
saaslayer --helpYour SaaSLayer login is also kept in your home directory, so it survives a new CloudShell session.
4. Create your SaaSLayer account and project
saaslayer signup
saaslayer login
saaslayer org create "Acme"
saaslayer project create "Acme app" --slug acme-app
saaslayer contextsignup emails you a code; it takes about 2 minutes. org create and
project create select the new organization and project.
Now connect your account. In CloudShell you don't need
--profile: the CLI uses CloudShell's credentials.
Path B: existing account or security team
Use this path when you already have an AWS account, when someone else administers it, or when you don't want SaaSLayer setup to run as a full administrator.
What the bootstrap permissions allow
The bootstrap policy lets one person do the account-side SaaSLayer setup, and nothing else:
- create, update and delete the two foundation CloudFormation stacks,
saaslayer-foundationandsaaslayer-foundation-<region>; - manage the IAM roles and policies named
sl-foundation-*that those stacks hold; - manage the SSM parameters under
/saaslayer/foundation/; - manage the deployment-artifact buckets named
sl-artifacts-*.
It grants no access to your other stacks, roles, buckets or data. It does let
its holder write the permissions of the sl-foundation-* roles. Treat it like
IAM administration and assign it only to people you would trust with that.
Two optional add-ons are only for features you choose later:
- Email sender domain: send your app's email from your
own domain (
--email-sender-domain). - SMS sending number: a US toll-free number for phone
sign-in (
--sms-toll-free). Registering the number withsaaslayer aws sms registerneeds more SMS permissions than this add-on.
The policies use the commercial AWS partition (arn:aws:).
Option 1: IAM Identity Center permission set (recommended)
An IAM Identity Center administrator does this once:
- Open IAM Identity Center. Choose Multi-account permissions, then Permission sets, then Create permission set.
- Choose Custom permission set, then Next.
- Expand Inline policy and paste the
permission set policy. It's the core
policy and both add-ons in one document, because a permission set holds a
single inline policy. Remove the
EmailSenderDomainandSmsSendingNumberstatements if you don't want those features. Choose Next. - Name it
SaaSLayerBootstrap. Set the session duration to at least 4 hours, so credentials don't expire during setup. Choose Next, then Create. - Choose AWS accounts, select the account to connect and choose
Assign users or groups. Pick the people who will set up SaaSLayer, then
the
SaaSLayerBootstrappermission set, and choose Submit.
Then the person who sets up SaaSLayer creates a profile for it in the AWS CLI on their own computer, using AWS CLI version 2:
aws configure ssoAnswer the prompts:
- SSO session name:
saaslayer - SSO start URL: your AWS access portal URL
- SSO region: the region where IAM Identity Center is set up
A browser window asks you to sign in. Back in the terminal, choose the account
and the SaaSLayerBootstrap role. Set the default region to the region you'll
deploy to. Name the profile saaslayer-bootstrap.
Check that the profile works and points at the right account:
aws sts get-caller-identity --profile saaslayer-bootstrapAccount must be the account you're connecting. Arn names the
AWSReservedSSO_SaaSLayerBootstrap_… role. When the session expires, sign in
again with aws sso login --profile saaslayer-bootstrap.
Option 2: IAM role, without IAM Identity Center
An IAM administrator does this once:
- Open IAM. Choose Policies, then Create policy. Choose JSON,
paste the core policy, then choose Next. Name it
SaaSLayerBootstrapand choose Create policy. Repeat for any add-on you want, asSaaSLayerBootstrapEmailSenderorSaaSLayerBootstrapSmsNumber. - Choose Roles, then Create role. Choose Custom trust policy and
paste the trust policy. Replace
YOUR_AWS_ACCOUNT_IDwith the account's ID, then choose Next. - Select
SaaSLayerBootstrapand any add-on policies, then choose Next. - Name the role
SaaSLayerBootstrapand choose Create role. Open the new role, choose Edit, and set Maximum session duration to 4 hours. - Allow the people who will set up SaaSLayer to assume it. Each person's IAM user (or their group) needs this permission, and an MFA device:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::YOUR_AWS_ACCOUNT_ID:role/SaaSLayerBootstrap"
}
]
}The trust policy requires MFA. The person adds a profile to ~/.aws/config
that assumes the role from their usual IAM user profile:
[profile saaslayer-bootstrap]
role_arn = arn:aws:iam::YOUR_AWS_ACCOUNT_ID:role/SaaSLayerBootstrap
source_profile = default
mfa_serial = arn:aws:iam::YOUR_AWS_ACCOUNT_ID:mfa/YOUR_MFA_DEVICE_NAME
duration_seconds = 14400
region = us-east-1Run this once and type your MFA code when asked:
aws sts get-caller-identity --profile saaslayer-bootstrapThe AWS CLI caches the role session. The saaslayer CLI can't answer an MFA
prompt, so run this check first, and again whenever the session expires.
Attaching the core policy straight to an IAM user with access keys also works. Avoid it if you can: long-lived keys are easy to leak.
Install the SaaSLayer CLI and sign in
On the computer where your profile lives, with Node.js 20 or newer:
npm install -g saaslayer
saaslayer signup
saaslayer login
saaslayer org create "Acme"
saaslayer project create "Acme app" --slug acme-app
saaslayer contextIf your organization and project already exist, use saaslayer org list,
saaslayer org use ORG_ID, saaslayer project list and
saaslayer project use PROJECT_ID instead.
Connect your account
Replace YOUR_AWS_ACCOUNT_ID, and run:
saaslayer aws connect --aws-account YOUR_AWS_ACCOUNT_ID --region us-east-1 --profile saaslayer-bootstrapIn CloudShell, leave out --profile. Without --profile, the CLI uses the
AWS CLI's default credentials: the AWS_PROFILE profile or AWS_* environment
variables. A first connect takes about 2 minutes. The CLI first checks that
your credentials belong to --aws-account; if they don't, it stops before
changing anything.
What it creates
Connecting registers the account with your SaaSLayer organization, then creates two CloudFormation stacks with your credentials:
| Stack | Where | What it holds | Created in |
|---|---|---|---|
saaslayer-foundation | Once per account, in the first region you connect (its home region) | Three IAM roles, four IAM policies (five with broad permissions) and one SSM parameter | about 1 minute |
saaslayer-foundation-<region> | Once per region you deploy to | One S3 bucket for deployment files | about 30 seconds |
The account stack holds:
sl-foundation-deploy-role. SaaSLayer assumes this role to deploy your services. It can only manage CloudFormation stacks whose names start withsl-, and only with a trust identifier that SaaSLayer holds. It can't create IAM roles itself.sl-foundation-cfn-exec-role. CloudFormation uses this role to create the services' resources. Only CloudFormation can use it.sl-foundation-support-ro-role. SaaSLayer support can use this role to diagnose problems. It can only read, and can't read your data.sl-foundation-scoped-boundary. A permissions boundary. Every IAM role that a SaaSLayer service creates stays within it. With scoped permissions it allows SaaSLayer's own resources only; with broad permissions, every action except IAM, Organizations and account management.sl-foundation-web-identity-boundary. The permissions boundary of the roles your app's signed-in users get. It only allows calling your services' APIs in this account.sl-foundation-cfn-exec-policy. More permissions for the CloudFormation role.sl-foundation-deploy-policy. More permissions for the deploy role.sl-foundation-broad-guardrails. Only with broad permissions: what SaaSLayer may never do in your account, attached to the deploy and CloudFormation roles. See Permission modes./saaslayer/foundation/connection-authorizers. An SSM parameter that lists who may connect this account to SaaSLayer organizations. It holds no secret.
What SaaSLayer can do in your AWS account describes each role in full, how to audit them, and what changes in each foundation release.
The region stack holds the sl-artifacts-<region>-<id> bucket. Every SaaSLayer
service deploys its packaged code there. It's private, encrypted and versioned,
accepts only TLS, and deletes files older than 90 days.
Who can connect later. The role you connect with becomes the account's
connection authorizer. For example, that's the SaaSLayerBootstrap permission
set, or the IAM role. Anyone who can use that same role can later connect the
account to another organization or region. To change the list, use
saaslayer aws authorizers add|remove.
Check it
saaslayer aws foundation status --region us-east-1 --profile saaslayer-bootstrapIt shows both stacks, their status, and the installed and latest versions. You
can also see them in the AWS console under CloudFormation, then Stacks.
To connect another region later, run saaslayer aws connect again with that
--region. It adds only that region's stack.
What it costs
The foundation itself costs almost nothing:
- IAM roles, IAM policies, the SSM parameter and CloudFormation are free.
- The S3 bucket bills only for what's stored in it: your deployment files, a few megabytes to a few hundred, usually cents a month.
- An SMS sending number costs about 2 USD a month, and only if you choose one.
The services you deploy are billed by AWS as you use them: Lambda, DynamoDB, Cognito, API Gateway and others. Keep the budget alert from path A in place.
Your first dev deployment
Deploy Users and Permissions into the connected account:
saaslayer deploy --module user-service --module permissions-service --hosting byoa --env dev --region us-east-1 --admin-email you@example.com
saaslayer status --env dev --region us-east-1The first deployment of these two services takes about 11 minutes. The deploy itself doesn't use your AWS credentials: SaaSLayer deploys through the connection you just made. Continue with the first setup guide to sign in to your deployment.
Troubleshooting
"Unable to locate credentials", or the token has expired
Run aws sts get-caller-identity --profile saaslayer-bootstrap. If it fails,
sign in again: aws sso login --profile saaslayer-bootstrap for IAM Identity
Center. For an IAM role, run the same get-caller-identity command and enter
your MFA code.
If SSO sign-in works but SaaSLayer still reports expired or wrong-account
credentials, look in ~/.aws/credentials. A section with the same name as your
profile, for example [saaslayer-bootstrap], holds fixed keys. Old keys
pasted there earlier win over your SSO sign-in in ~/.aws/config. Delete that
section, then run get-caller-identity again.
Without --profile, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and
AWS_SESSION_TOKEN in your shell win over profiles. Run env | cut -d= -f1 | grep '^AWS_'
to list variable names without printing credentials. Use unset for variables
you didn't mean to set.
AccessDenied
The error names the AWS action and resource that was refused:
- Check which identity you're using:
aws sts get-caller-identity.Arnshould name theSaaSLayerBootstraprole (or an administrator). - Compare the role's policy with the current policies. A newer CLI version may need permissions an older copy lacks.
- If your account belongs to an AWS Organization, a service control policy can deny an action whatever your own policy says. For example, it might block IAM changes or some regions. Ask your organization's administrators.
Wrong account or region
aws connect refuses credentials for another account before it changes
anything: "your AWS credentials are for account …, not …". Switch with
--profile, then rerun.
The account stack lives in the region you first connected. If you connect a
second region, aws connect adds only that region's stack. Errors that say the
trust relationship is "blocked for reconciliation" mean the account's foundation
is in an unexpected state. Don't delete anything; contact us.
A stack failed part-way
CloudFormation undoes a failed create, and the CLI prints the next step. If the
CLI says the account is registered and to rerun saaslayer aws connect, fix the
cause first (usually AccessDenied, above), then rerun the same command.
If a stack is ROLLBACK_COMPLETE or UPDATE_ROLLBACK_FAILED, its foundation
roles are missing, or the CLI reports that reconciliation is required, stop and
contact us. Include the account ID, region, stack name, status and
sanitized CLI error. Keep credentials, signing secrets and tokens out of your
report. Don't delete or edit managed stacks, IAM roles or deployment records:
these changes can disconnect existing deployments and leave SaaSLayer's records
out of sync.
Credentials expired in the middle of a command
saaslayer deploy and saaslayer status don't use your AWS credentials, so an
expired AWS sign-in doesn't stop a deployment that's running.
aws connect and foundation upgrade do. If your sign-in expires while one of
them waits, CloudFormation still finishes the stack. Sign in again, wait until
the stack shows CREATE_COMPLETE or UPDATE_COMPLETE in CloudFormation, then
rerun the same command. A rerun picks up where the last one stopped. A 4-hour
session avoids this.
In CloudShell, an idle session closes after 20 to 30 minutes. A deployment
keeps running; reopen CloudShell and check it with saaslayer status.
Bootstrap policy reference
These are the same files the SaaSLayer CLI is tested against. Copy them as they are.
Core policy
Needed for saaslayer aws connect, saaslayer aws foundation status,
saaslayer aws foundation upgrade, saaslayer aws authorizers and
saaslayer aws rotate-trust, and to delete a failed foundation stack.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "FoundationStacks",
"Effect": "Allow",
"Action": [
"cloudformation:CreateStack",
"cloudformation:DeleteStack",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:GetTemplate",
"cloudformation:CreateChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:ExecuteChangeSet",
"cloudformation:DeleteChangeSet",
"cloudformation:ContinueUpdateRollback"
],
"Resource": [
"arn:aws:cloudformation:*:*:stack/saaslayer-foundation*/*",
"arn:aws:cloudformation:*:*:changeSet/saaslayer-*/*"
]
},
{
"Sid": "FindStacks",
"Effect": "Allow",
"Action": [
"cloudformation:ListStacks",
"cloudformation:ValidateTemplate",
"cloudformation:DescribeStackResources"
],
"Resource": "*"
},
{
"Sid": "FoundationRoles",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:DeleteRole",
"iam:GetRole",
"iam:UpdateRole",
"iam:UpdateRoleDescription",
"iam:UpdateAssumeRolePolicy",
"iam:PutRolePolicy",
"iam:GetRolePolicy",
"iam:DeleteRolePolicy",
"iam:ListRolePolicies",
"iam:AttachRolePolicy",
"iam:DetachRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:PutRolePermissionsBoundary",
"iam:DeleteRolePermissionsBoundary",
"iam:TagRole",
"iam:UntagRole",
"iam:ListRoleTags"
],
"Resource": "arn:aws:iam::*:role/sl-foundation-*"
},
{
"Sid": "FoundationManagedPolicies",
"Effect": "Allow",
"Action": [
"iam:CreatePolicy",
"iam:DeletePolicy",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:ListPolicyVersions",
"iam:CreatePolicyVersion",
"iam:DeletePolicyVersion",
"iam:ListEntitiesForPolicy"
],
"Resource": "arn:aws:iam::*:policy/sl-foundation-*"
},
{
"Sid": "FoundationParameter",
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:PutParameter",
"ssm:DeleteParameter",
"ssm:AddTagsToResource",
"ssm:RemoveTagsFromResource",
"ssm:ListTagsForResource"
],
"Resource": "arn:aws:ssm:*:*:parameter/saaslayer/foundation/*"
},
{
"Sid": "ArtifactBuckets",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:DeleteBucket*",
"s3:Get*",
"s3:List*",
"s3:Put*",
"s3:TagResource",
"s3:UntagResource"
],
"Resource": "arn:aws:s3:::sl-artifacts-*"
},
{
"Sid": "ArtifactBucketObjects",
"Effect": "Allow",
"Action": [
"s3:DeleteObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::sl-artifacts-*",
"arn:aws:s3:::sl-artifacts-*/*"
]
}
]
}Email sender add-on
For --email-sender-domain on saaslayer aws connect or
saaslayer aws foundation upgrade.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EmailSenderDomain",
"Effect": "Allow",
"Action": [
"ses:CreateEmailIdentity",
"ses:DeleteEmailIdentity",
"ses:GetEmailIdentity",
"ses:PutEmailIdentityDkimAttributes",
"ses:PutEmailIdentityDkimSigningAttributes",
"ses:PutEmailIdentityFeedbackAttributes",
"ses:PutEmailIdentityMailFromAttributes",
"ses:TagResource",
"ses:UntagResource",
"ses:ListTagsForResource"
],
"Resource": "arn:aws:ses:*:*:identity/*"
}
]
}SMS number add-on
For --sms-toll-free on saaslayer aws connect. It covers creating and
removing the number with the region stack.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SmsSendingNumber",
"Effect": "Allow",
"Action": [
"sms-voice:RequestPhoneNumber",
"sms-voice:DescribePhoneNumbers",
"sms-voice:UpdatePhoneNumber",
"sms-voice:ReleasePhoneNumber",
"sms-voice:DescribeKeywords",
"sms-voice:PutKeyword",
"sms-voice:DeleteKeyword",
"sms-voice:TagResource",
"sms-voice:UntagResource",
"sms-voice:ListTagsForResource"
],
"Resource": "*"
}
]
}Permission set inline policy
The core policy and both add-ons, for an IAM Identity Center permission set.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "FoundationStacks",
"Effect": "Allow",
"Action": [
"cloudformation:CreateStack",
"cloudformation:DeleteStack",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:GetTemplate",
"cloudformation:CreateChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:ExecuteChangeSet",
"cloudformation:DeleteChangeSet",
"cloudformation:ContinueUpdateRollback"
],
"Resource": [
"arn:aws:cloudformation:*:*:stack/saaslayer-foundation*/*",
"arn:aws:cloudformation:*:*:changeSet/saaslayer-*/*"
]
},
{
"Sid": "FindStacks",
"Effect": "Allow",
"Action": [
"cloudformation:ListStacks",
"cloudformation:ValidateTemplate",
"cloudformation:DescribeStackResources"
],
"Resource": "*"
},
{
"Sid": "FoundationRoles",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:DeleteRole",
"iam:GetRole",
"iam:UpdateRole",
"iam:UpdateRoleDescription",
"iam:UpdateAssumeRolePolicy",
"iam:PutRolePolicy",
"iam:GetRolePolicy",
"iam:DeleteRolePolicy",
"iam:ListRolePolicies",
"iam:AttachRolePolicy",
"iam:DetachRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:PutRolePermissionsBoundary",
"iam:DeleteRolePermissionsBoundary",
"iam:TagRole",
"iam:UntagRole",
"iam:ListRoleTags"
],
"Resource": "arn:aws:iam::*:role/sl-foundation-*"
},
{
"Sid": "FoundationManagedPolicies",
"Effect": "Allow",
"Action": [
"iam:CreatePolicy",
"iam:DeletePolicy",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:ListPolicyVersions",
"iam:CreatePolicyVersion",
"iam:DeletePolicyVersion",
"iam:ListEntitiesForPolicy"
],
"Resource": "arn:aws:iam::*:policy/sl-foundation-*"
},
{
"Sid": "FoundationParameter",
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:PutParameter",
"ssm:DeleteParameter",
"ssm:AddTagsToResource",
"ssm:RemoveTagsFromResource",
"ssm:ListTagsForResource"
],
"Resource": "arn:aws:ssm:*:*:parameter/saaslayer/foundation/*"
},
{
"Sid": "ArtifactBuckets",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:DeleteBucket*",
"s3:Get*",
"s3:List*",
"s3:Put*",
"s3:TagResource",
"s3:UntagResource"
],
"Resource": "arn:aws:s3:::sl-artifacts-*"
},
{
"Sid": "ArtifactBucketObjects",
"Effect": "Allow",
"Action": [
"s3:DeleteObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::sl-artifacts-*",
"arn:aws:s3:::sl-artifacts-*/*"
]
},
{
"Sid": "EmailSenderDomain",
"Effect": "Allow",
"Action": [
"ses:CreateEmailIdentity",
"ses:DeleteEmailIdentity",
"ses:GetEmailIdentity",
"ses:PutEmailIdentityDkimAttributes",
"ses:PutEmailIdentityDkimSigningAttributes",
"ses:PutEmailIdentityFeedbackAttributes",
"ses:PutEmailIdentityMailFromAttributes",
"ses:TagResource",
"ses:UntagResource",
"ses:ListTagsForResource"
],
"Resource": "arn:aws:ses:*:*:identity/*"
},
{
"Sid": "SmsSendingNumber",
"Effect": "Allow",
"Action": [
"sms-voice:RequestPhoneNumber",
"sms-voice:DescribePhoneNumbers",
"sms-voice:UpdatePhoneNumber",
"sms-voice:ReleasePhoneNumber",
"sms-voice:DescribeKeywords",
"sms-voice:PutKeyword",
"sms-voice:DeleteKeyword",
"sms-voice:TagResource",
"sms-voice:UntagResource",
"sms-voice:ListTagsForResource"
],
"Resource": "*"
},
{
"Sid": "TemplateGuardHook",
"Effect": "Allow",
"Action": [
"cloudformation:ActivateType",
"cloudformation:DeactivateType",
"cloudformation:DescribeType",
"cloudformation:ListTypes",
"cloudformation:SetTypeConfiguration",
"cloudformation:BatchDescribeTypeConfigurations"
],
"Resource": "*"
},
{
"Sid": "TemplateGuardRole",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::*:role/sl-foundation-template-guard-*"
}
]
}Trust policy
For the SaaSLayerBootstrap IAM role in option 2.
Replace YOUR_AWS_ACCOUNT_ID. People in your account can assume the role only
if they signed in with MFA and their own permissions allow sts:AssumeRole on
it.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AdministratorsOfThisAccountWithMfa",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR_AWS_ACCOUNT_ID:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"Bool": {
"aws:MultiFactorAuthPresent": "true"
}
}
}
]
}Work with an agent
Use these instructions with your coding assistant. Read the proposed actions and confirm the target account and environment before creating AWS resources.
## Instructions
Help me install and sign in to the SaaSLayer customer CLI. First read https://saaslayer.com/docs/getting-started/aws-account-setup.md and https://saaslayer.com/docs/getting-started/first-customer-instance.md. If you cannot read a guide, ask me to use its Copy page for AI button and paste it; do not invent commands.
Ask whether I am using AWS CloudShell or my own computer, and confirm beta admission before AWS setup. Check existing Node.js and CLI installations before changing anything. Use the guide's home-directory installation in CloudShell. Let me enter my own password, confirmation code and MFA code at hidden prompts; never ask me to paste secrets into chat, command flags or logs.
Use saaslayer signup only if I need a new management account; otherwise use saaslayer login. Inspect saaslayer context, org list and projects before creating an organization or project. Ask which existing ones to use. Explain that a SaaSLayer organization is separate from an AWS Organization. Finish by showing the CLI version and selected context, with secrets omitted. Stop before connecting AWS or deploying services.
## Instructions
Help me prepare an AWS account and connect it to SaaSLayer using https://saaslayer.com/docs/getting-started/aws-account-setup.md. If you cannot read the guide, ask me to copy its page for AI. Confirm beta admission, the target AWS account, region, SaaSLayer organization and project. Ask whether the account is new or administered by a security team.
Explain AWS billing and the account-plan consequences before I enable Identity Center with AWS Organizations: this can upgrade a Free account to Paid and expire its Free Tier credits. Explain that the bootstrap policy permits privileged IAM trust and permission changes. Have me complete account signup, root MFA, AWS permission grants and browser sign-in myself; do not create IAM access keys or collect credentials in chat. A budget alert does not cap spending.
Inspect the selected identity with aws sts get-caller-identity, using my chosen local profile or no --profile in CloudShell. Inspect saaslayer context. Before any AWS write, show the account ID, region, organization, project, expected foundation stacks and command, and wait for my explicit approval. Use saaslayer aws connect for installation and saaslayer aws foundation status to check both stacks. Do not enable optional email or SMS features unless I request them and approve their costs. Stop before deploying app services. If setup rolls back or is blocked for reconciliation, follow the support handoff; never delete or edit managed stacks, IAM roles, SSM parameters or deployment records directly.