Skip to main content

IAM Roles & Permissions

This document explains the IAM roles and permissions required for Ownstak to provision and manage resources in your AWS account.

CloudFormation Templates

Ownstak provides two CloudFormation templates for setting up the required IAM roles:

The standard template includes broad permissions that allow Ownstak to manage all aspects of your AWS infrastructure. This template is recommended for most users as it provides flexibility for future Ownstak features.

Download Standard Template (ownstak_iam_roles.yml)

Minimal Template

The minimal template includes only the essential permissions required for current Ownstak functionality. This template is suitable for users who prefer the principle of least privilege.

Note: If you use the minimal template, you may need to update it when new Ownstak features are released.

Download Minimal Template (ownstak_iam_roles_minimal.yml)

Deploying the Templates

  1. Download one of the templates above
  2. In the AWS CloudFormation console, create a new stack
  3. Upload the template file
  4. Review and create the stack

After deployment, you'll have an IAM user called "OwnstakCloudCredentialsUser" that you can use to generate access keys for Ownstak.

Detailed Permission Analysis

The following table documents every permission in the minimal template and explains how Ownstak uses it:

ACM (Certificate Manager) Permissions

PermissionPurpose
acm:ListCertificatesChecks if SSL certificates already exist for the domain
acm:RequestCertificateCreates new SSL certificates for *.your-backend.your-org.ownstak.link domains
acm:DeleteCertificateRemoves SSL certificates when tearing down cloud backends
acm:DescribeCertificateChecks certificate validation status and retrieves DNS validation records
acm:AddTagsToCertificateAdds tags to certificates for resource management

EC2 Permissions

PermissionPurpose
ec2:AuthorizeSecurityGroupIngressAdds inbound rules to security groups for ALB and ECS communication
ec2:CreateSecurityGroupCreates security groups for Application Load Balancer and ECS tasks
ec2:CreateTagsTags security groups for resource management
ec2:DeleteSecurityGroupRemoves security groups during teardown
ec2:DescribeAccountAttributesChecks account limits and capabilities
ec2:DescribeInstancesLists EC2 instances for single-instance mode management
ec2:DescribeSecurityGroupsChecks if security groups already exist
ec2:DescribeSubnetsDiscovers available subnets for VPC configuration
ec2:DescribeVpcsFinds default VPC or validates custom VPC configuration
ec2:RunInstancesCreates EC2 instances for single-instance mode deployments
ec2:TerminateInstancesRemoves EC2 instances during single-instance mode teardown

Elastic Load Balancing Permissions

PermissionPurpose
elasticloadbalancing:AddTagsTags load balancers for resource management
elasticloadbalancing:CreateListenerCreates HTTP (80) and HTTPS (443) listeners on the ALB
elasticloadbalancing:CreateLoadBalancerCreates Application Load Balancer in public subnets
elasticloadbalancing:CreateTargetGroupCreates target groups for routing traffic to ECS tasks
elasticloadbalancing:DeleteLoadBalancerRemoves ALB during teardown
elasticloadbalancing:DeleteTargetGroupRemoves target groups during teardown
elasticloadbalancing:DescribeLoadBalancersChecks if ALB already exists
elasticloadbalancing:DescribeListenersChecks if listeners already exist
elasticloadbalancing:DescribeTargetGroupsChecks if target group already exists
elasticloadbalancing:ModifyTargetGroupAttributesConfigures deregistration delay for faster scaling

ECS (Elastic Container Service) Permissions

PermissionPurpose
ecs:DescribeClustersChecks if ECS cluster already exists
ecs:DescribeServicesChecks if ECS services already exist
ecs:DescribeTaskDefinitionRetrieves task definition details for comparison
ecs:ListServicesLists all services in a cluster for cleanup
ecs:ListTasksLists running tasks for cleanup during teardown
ecs:ListTaskDefinitionsLists task definition revisions for cleanup
ecs:DeregisterTaskDefinitionRemoves task definition revisions during teardown
ecs:CreateClusterCreates ECS cluster for running Lambda proxy
ecs:CreateServiceCreates ECS service for Lambda proxy
ecs:DeleteClusterRemoves ECS cluster during teardown
ecs:DeleteServiceRemoves ECS service during teardown
ecs:RegisterTaskDefinitionCreates new task definitions for Lambda proxy
ecs:StopTaskStops running tasks during teardown
ecs:TagResourceTags ECS resources for management
ecs:UpdateServiceUpdates ECS service with new task definitions

CloudWatch Logs Permissions

PermissionPurpose
logs:DescribeLogGroupsChecks if log groups already exist
logs:CreateLogGroupCreates log groups for ECS task logging
logs:DeleteLogGroupRemoves log groups during teardown
logs:GetLogEventsRetrieves log events for debugging and monitoring
logs:GetLogRecordGets specific log records for analysis
logs:ListTagsLogGroupLists tags on log groups for resource management
logs:PutRetentionPolicySets log retention policy (60 days)
logs:TagLogGroupTags log groups for resource management

Lambda Permissions

PermissionPurpose
lambda:ListFunctionsLists Lambda functions for cleanup during teardown
lambda:CreateAliasCreates version aliases for deployments (deployment-123)
lambda:CreateFunctionCreates Lambda functions for your applications
lambda:DeleteAliasRemoves aliases during teardown
lambda:GetAliasChecks if deployment alias already exists
lambda:GetFunctionChecks if Lambda function already exists
lambda:GetFunctionConfigurationRetrieves function configuration for updates
lambda:InvokeFunctionAllows invoking created Lambda functions
lambda:ListAliasesLists function aliases for cleanup and management
lambda:ListTagsRetrieves function tags
lambda:PublishVersionPublishes new versions of Lambda functions
lambda:TagResourceTags Lambda functions for management
lambda:UpdateAliasUpdates aliases to point to new versions
lambda:UpdateFunctionCodeUpdates Lambda function code from S3
lambda:UpdateFunctionConfigurationUpdates Lambda function configuration

IAM Permissions

PermissionPurpose
iam:CreateServiceLinkedRoleCreates service-linked role for Elastic Load Balancing
iam:GetRoleChecks if IAM roles already exist
iam:GetInstanceProfileChecks if IAM instance profiles already exist
iam:passRoleAllows passing IAM roles to Lambda and ECS services

Note: The iam:passRole permission is limited to the following specific roles:

  • ownstak-lambda-execution-role: For Lambda function execution
  • ownstak-ecs-execution-role: For ECS task execution
  • ownstak-ecs-task-role: For ECS task runtime permissions
  • ownstak-ec2-instance-profile-role: For EC2 single-instance mode

S3 Permissions

PermissionPurpose
s3:CreateBucketCreates S3 buckets for assets, compute, and permanent assets
s3:DeleteBucketRemoves S3 buckets during teardown
s3:DeleteObjectRemoves objects during bucket cleanup
s3:GetObjectRetrieves deployment artifacts from S3
s3:GetObjectAttributesChecks object metadata
s3:ListBucketLists bucket contents for cleanup
s3:PutBucketPolicySets public read policy for public asset buckets
s3:PutBucketPublicAccessBlockConfigures public access settings for public buckets
s3:PutObjectUploads deployment artifacts to S3

IAM Roles Created

The templates create the following IAM roles:

Lambda Execution Role

  • Name: ownstak-lambda-execution-role
  • Purpose: Allows Lambda functions to access S3 buckets and VPC resources
  • Used by: Your application Lambda functions

ECS Execution Role

  • Name: ownstak-ecs-execution-role
  • Purpose: Allows ECS tasks to pull container images and write logs
  • Used by: Lambda proxy ECS tasks

ECS Task Role

  • Name: ownstak-ecs-task-role
  • Purpose: Allows ECS tasks to invoke Lambda functions
  • Used by: Lambda proxy ECS tasks

EC2 Instance Profile Role

  • Name: ownstak-ec2-instance-profile-role
  • Purpose: Allows EC2 instances to invoke Lambda functions (for single-instance mode)
  • Used by: EC2 instances in single-instance deployments

For more information about the AWS architecture, see the AWS Integration Guide.