Identity-based policy examples for Region switch in ARC - Amazon Application Recovery Controller (ARC)

Identity-based policy examples for Region switch in ARC

By default, users and roles don't have permission to create or modify ARC resources. They also can't perform tasks by using the AWS Management Console, AWS Command Line Interface (AWS CLI), or AWS API. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles.

To learn how to create an IAM identity-based policy by using these example JSON policy documents, see Create IAM policies (console) in the IAM User Guide.

For details about actions and resource types defined by ARC, including the format of the ARNs for each of the resource types, see Actions, resources, and condition keys for Amazon Application Recovery Controller (ARC) in the Service Authorization Reference.

Policy best practices

Identity-based policies determine whether someone can create, access, or delete ARC resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations:

  • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide.

  • Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide.

  • Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide.

  • Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see Validate policies with IAM Access Analyzer in the IAM User Guide.

  • Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Secure API access with MFA in the IAM User Guide.

For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide.

Plan execution role trust policy

This is the trust policy required for the plan's execution role:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "arc-region-switch.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

Full access permissions

The following IAM policy grants full access for all Region switch APIs:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "arc-region-switch.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "arc-region-switch:CreatePlan", "arc-region-switch:UpdatePlan", "arc-region-switch:GetPlan", "arc-region-switch:ListPlans", "arc-region-switch:DeletePlan", "arc-region-switch:GetPlanInRegion", "arc-region-switch:ListPlansInRegion", "arc-region-switch:ApprovePlanExecutionStep", "arc-region-switch:GetPlanEvaluationStatus", "arc-region-switch:GetPlanExecution", "arc-region-switch:CancelPlanExecution", "arc-region-switch:ListRoute53HealthChecks", "arc-region-switch:ListPlanExecutions", "arc-region-switch:ListPlanExecutionEvents", "arc-region-switch:ListTagsForResource", "arc-region-switch:TagResource", "arc-region-switch:UntagResource", "arc-region-switch:UpdatePlanExecution", "arc-region-switch:UpdatePlanExecutionStep" ], "Resource": "*" } ] }

Read-only permissions

The following IAM policy grants read-only access permissions for Region switch:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "arc-region-switch:GetPlan", "arc-region-switch:ListPlans", "arc-region-switch:GetPlanInRegion", "arc-region-switch:ListPlansInRegion", "arc-region-switch:GetPlanEvaluationStatus", "arc-region-switch:GetPlanExecution", "arc-region-switch:ListRoute53HealthChecks", "arc-region-switch:ListPlanExecutions", "arc-region-switch:ListPlanExecutionEvents", "arc-region-switch:ListTagsForResource" ], "Resource": "*" } ] }

Execution block permissions

The following sections provide IAM policies for specific execution blocks that you add to a Region switch plan.

EC2 Amazon EC2 Auto Scaling execution block

Policy for the plan execution role to manage EC2 Amazon EC2 Auto Scaling groups:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "autoscaling:DescribeAutoScalingGroups" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "autoscaling:UpdateAutoScalingGroup" ], "Resource": [ "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:123d456e-123e-1111-abcd-EXAMPLE22222:autoScalingGroupName/app-asg-primary", "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:1234a321-123e-1234-aabb-EXAMPLE33333:autoScalingGroupName/app-asg-secondary" ] }, { "Effect": "Allow", "Action": [ "cloudwatch:GetMetricStatistics" ], "Resource": "*", "Condition": { "StringEquals": { "cloudwatch:namespace": "AWS/AutoScaling" } } } ] }

Amazon EKS resource scaling execution block

Policy for the plan execution role to manage Amazon EKS clusters:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "eks:DescribeCluster" ], "Resource": [ "arn:aws:eks:us-east-1:123456789012:cluster/app-eks-primary", "arn:aws:eks:us-west-2:123456789012:cluster/app-eks-secondary" ] }, { "Effect": "Allow", "Action": [ "eks:ListAssociatedAccessPolicies" ], "Resource": [ "arn:aws:eks:us-east-1:123456789012:access-entry/app-eks-primary/*", "arn:aws:eks:us-west-2:123456789012:access-entry/app-eks-secondary/*" ] } ] }

Note: In addition to this IAM policy, the plan execution role needs to be added to the Amazon EKS cluster's access entries with the AmazonArcRegionSwitchScalingPolicy access policy. For more information, see Configure EKS access entry permissions.

Amazon ECS service scaling execution block

Policy for the plan execution role to manage Amazon ECS services:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:DescribeServices", "ecs:UpdateService" ], "Resource": [ "arn:aws:ecs:us-east-1:123456789012:service/app-cluster-primary/app-service", "arn:aws:ecs:us-west-2:123456789012:service/app-cluster-secondary/app-service" ] }, { "Effect": "Allow", "Action": [ "ecs:DescribeClusters" ], "Resource": [ "arn:aws:ecs:us-east-1:123456789012:cluster/app-cluster-primary", "arn:aws:ecs:us-west-2:123456789012:cluster/app-cluster-secondary" ] }, { "Effect": "Allow", "Action": [ "ecs:ListServices" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "application-autoscaling:DescribeScalableTargets", "application-autoscaling:RegisterScalableTarget" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "cloudwatch:GetMetricStatistics" ], "Resource": "*", "Condition": { "StringEquals": { "cloudwatch:namespace": "ECS/ContainerInsights" } } } ] }

ARC routing controls execution block

Note: The Amazon ARC routing controls execution block requires that any Service Control Policies (SCPs) applied to the plan's execution role allow the access to the following Regions for these services:

  • route53-recovery-control-config: us-west-2

  • route53-recovery-cluster: us-west-2, us-east-1, eu-west-1, ap-southeast-2, ap-northeast-1

Policy for the plan execution role to manage ARC routing controls:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "route53-recovery-control-config:DescribeControlPanel", "route53-recovery-control-config:DescribeCluster" ], "Resource": [ "arn:aws:route53-recovery-control::123456789012:controlpanel/abcd1234abcd1234abcd1234abcd1234", "arn:aws:route53-recovery-control::123456789012:cluster/4b325d3b-0e28-4dcf-ba4a-EXAMPLE11111" ] }, { "Effect": "Allow", "Action": [ "route53-recovery-cluster:GetRoutingControlState", "route53-recovery-cluster:UpdateRoutingControlStates" ], "Resource": [ "arn:aws:route53-recovery-control::123456789012:controlpanel/1234567890abcdef1234567890abcdef/routingcontrol/abcdef1234567890", "arn:aws:route53-recovery-control::123456789012:controlpanel/1234567890abcdef1234567890abcdef/routingcontrol/1234567890abcdef" ] } ] }

You can retrive the routing control control panel ID and the Cluster ID using CLI. For more information, see Set up routing control components.

Aurora Global Database execution block

Policy for the plan execution role to manage Aurora global databases:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "rds:DescribeGlobalClusters", "rds:DescribeDBClusters" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "rds:FailoverGlobalCluster", "rds:SwitchoverGlobalCluster" ], "Resource": [ "arn:aws:rds:us-east-1:123456789012:global-cluster:app-global-db", "arn:aws:rds:us-east-1:123456789012:cluster:app-db-primary", "arn:aws:rds:us-west-2:123456789012:cluster:app-db-secondary" ] } ] }

Manual approval execution block

Policy for the role that can approve manual steps:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "arc-region-switch:ApprovePlanExecutionStep" ], "Resource": "arn:aws:arc-region-switch::123456789012:plan/sample-plan:0fba5e" } ] }

Custom action Lambda execution block

Policy for the plan execution role to invoke Lambda functions:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lambda:GetFunction", "lambda:InvokeFunction" ], "Resource": [ "arn:aws:lambda:us-east-1:123456789012:function:app-recovery-primary", "arn:aws:lambda:us-west-2:123456789012:function:app-recovery-secondary" ] } ] }

Route 53 health check execution block

Policy for the plan execution role to use Route 53 health checks:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "route53:ListResourceRecordSets" ], "Resource": [ "arn:aws:route53:::hostedzone/Z1234567890ABCDEFGHIJ" ] } ] }

Region switch plan execution block

Policy for the plan execution role to execute child plans:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "arc-region-switch:StartPlanExecution", "arc-region-switch:GetPlanExecution", "arc-region-switch:CancelPlanExecution", "arc-region-switch:UpdatePlanExecution", "arc-region-switch:ListPlanExecutions" ], "Resource": [ "arn:aws:arc-region-switch::123456789012:plan/child-plan-1:50c1a1", "arn:aws:arc-region-switch::123456789012:plan/child-plan-2:d1e5e1" ] } ] }

CloudWatch alarms for application health

Policy for the plan execution role to access CloudWatch alarms for application health, which are used to help determine actual recovery time:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:DescribeAlarmHistory", "cloudwatch:DescribeAlarms" ], "Resource": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:app-health-primary", "arn:aws:cloudwatch:us-west-2:123456789012:alarm:app-health-secondary" ] } ] }

Cross-account resource access

If resources are in different accounts, you'll need a cross-account role. Here's a sample trust policy for a cross-account role:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/RegionSwitchExecutionRole" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "sts:ExternalId": "UniqueExternalId123" } } } ] }

And the permission for the plan execution role to assume this cross-account role:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::987654321098:role/RegionSwitchCrossAccountRole", "Condition": { "StringEquals": { "sts:ExternalId": "UniqueExternalId123" } } } ] }

Complete plan execution role policy

A comprehensive policy that includes permissions for all execution blocks would be quite large. In practice, you should only include permissions for the execution blocks that you use in your specific plan. Here's an example policy:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:SimulatePrincipalPolicy", "Resource": "arn:aws:iam::123456789012:role/RegionSwitchExecutionRole" }, { "Effect": "Allow", "Action": [ "arc-region-switch:GetPlan", "arc-region-switch:GetPlanExecution", "arc-region-switch:ListPlanExecutions" ], "Resource": "*" }, // Include additional statements for specific execution blocks here ] }

Remember to include only the permissions required for the specific execution blocks that you use in your plan, to follow the principle of least privilege.