This topic describes how to complete cloud account authorization for BYOC scenarios in OceanBase Cloud. Currently, AWS is supported.
Prerequisites
You have a valid OceanBase Cloud account with management permissions for the target project (Project Owner or Project Admin).
You have a valid AWS root account and can access the AWS Management Console.
Switch the current project to a BYOC project.
You have created an object storage bucket. For details, see Amazon S3 Console.
Procedure
Log in to the OceanBase Cloud console and switch the project to the target BYOC project in the top menu bar.
In the left-side navigation pane, click Project Settings. On the Project Settings page, click BYOC Cloud Account Authorization.
Click Create Cloud Account Authorization, and enter a name for the Cloud Account Authorization Name. The name must be 2 to 64 characters long and can only contain Chinese characters, numbers, English letters, underscores, and hyphens.
Select Authorized Cloud Service Provider as AWS and follow the AWS instructions to complete the subsequent configuration. See the AWS Authorization Configuration section below.
Configure AWS authorization
Notice
When selecting AWS as the underlying cloud environment, you must contact AWS Technical Support in advance to enable the special Proxy Protocol v2 attribute setting in the NLB target group properties for your account and target region: proxy_protocol_v2.client_to_server.header_placement=on_first_ack (sends the header immediately after establishing a connection, suitable for protocols like MySQL). This attribute is enabled separately for each account and region. Plan the regions you need and enable it in each of them before creating instances. Otherwise, you may be unable to connect to a tenant after creating it.
Create an IAM role in the AWS console for cross-account access to OceanBase Cloud.
Log in to the AWS Management Console and go to IAM > Roles. Click Create Role.
In Select Trusted Entity Type, choose AWS Account and select Another AWS Account.
Enter the root account ID provided in the OceanBase Cloud authorization dialog box in the Account ID field.
Select Require External ID and enter the External ID provided in the OceanBase Cloud authorization dialog box.
In the Add Permissions step, select Create Inline Policy and paste the policy JSON provided in the OceanBase Cloud authorization dialog box into the policy editing field. If the policy contains placeholders such as an object storage bucket, replace them with your actual resource information, for example, the name of the S3 storage bucket used for backup. Examples of policy content and explanations for placeholders are provided in the Permission Policy and Trust Policy section below.
Name the role as prompted and complete the creation.
Note
The policies provided by OceanBase Cloud are the minimum permission sets required for BYOC scenarios. Do not delete any critical permission items, as this may cause subsequent creation or operational failures.
Authorization verification:
Go to the role details page and copy its ARN (Role ARN).
Return to the OceanBase Cloud authorization dialog box and paste the Role ARN into the ARN input field.
Click OK to complete the authorization.
Permission policies and trust policies
To accommodate the longer policy content in OceanBase Cloud, it is recommended to use inline policies rather than customer-managed policies: inline policies have a character limit of 10,240, while customer-managed policies have a limit of 6,144. Moreover, in decommissioning scenarios, deleting the role is sufficient when using an inline policy, eliminating the need to delete the policy content separately.
Permission policy: Used as an inline policy when adding permissions during role creation. Before pasting, replace <CUSTOMER_AWS_ACCOUNT_ID> with your own AWS account ID and <BYOC_BUCKET_NAME> with the name of the S3 bucket to which you have granted OceanBase Cloud access.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "OceanBaseActionsWithoutTagCondition",
"Effect": "Allow",
"Action": [
"ec2:DescribeAddresses",
"ec2:DescribeAvailabilityZones",
"ec2:DescribeIamInstanceProfileAssociations",
"ec2:DescribeImages",
"ec2:DescribeInternetGateways",
"ec2:DescribeInstanceAttribute",
"ec2:DescribeInstanceTypeOfferings",
"ec2:DescribeInstanceTypes",
"ec2:DescribeInstances",
"ec2:DescribeNatGateways",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribePlacementGroups",
"ec2:DescribeReplaceRootVolumeTasks",
"ec2:DescribeRouteTables",
"ec2:DescribeSecurityGroupRules",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeVolumes",
"ec2:DescribeVpcEndpointConnections",
"ec2:DescribeVpcEndpointServiceConfigurations",
"ec2:DescribeVpcEndpointServicePermissions",
"ec2:DescribeVpcPeeringConnections",
"ec2:DescribeVpcs",
"ec2:GetInstanceTypesFromInstanceRequirements",
"ec2:AllocateAddress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:AttachInternetGateway",
"ec2:CreateInternetGateway",
"ec2:CreateLaunchTemplate",
"ec2:CreateNatGateway",
"ec2:CreatePlacementGroup",
"ec2:DeletePlacementGroup",
"ec2:CreateRoute",
"ec2:DeleteRoute",
"ec2:CreateRouteTable",
"ec2:CreateSecurityGroup",
"ec2:CreateSubnet",
"ec2:CreateVolume",
"ec2:CreateVpc",
"ec2:CreateVpcEndpointServiceConfiguration",
"ec2:CreateVpcPeeringConnection",
"ec2:RunInstances",
"ec2:CreateNetworkInterface",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:DescribeLoadBalancerAttributes",
"elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeTags",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:CreateListener",
"elasticloadbalancing:CreateLoadBalancer",
"elasticloadbalancing:CreateTargetGroup",
"eks:DescribeCluster",
"eks:DescribeNodegroup",
"eks:ListClusters",
"eks:ListNodegroups",
"eks:CreateCluster",
"eks:CreateNodegroup",
"eks:DescribeAddon",
"eks:CreateAddon",
"eks:UpdateAddon",
"eks:DescribePodIdentityAssociation",
"elasticfilesystem:DescribeFileSystems",
"elasticfilesystem:DescribeMountTargets",
"elasticfilesystem:CreateFileSystem",
"ecr:DescribeImages",
"ecr:DescribeRepositories",
"ecr:ListImages",
"iam:ListPolicies",
"ssm:DescribeInstanceInformation",
"ssm:GetCommandInvocation",
"ssm:ListCommandInvocations",
"route53:AssociateVPCWithHostedZone",
"route53:ChangeResourceRecordSets",
"route53:ChangeTagsForResource",
"route53:CreateHostedZone",
"route53:DeleteHostedZone",
"route53:GetHostedZone",
"route53:ListHostedZones",
"route53:ListResourceRecordSets",
"cloudwatch:GetMetricData",
"autoscaling:DescribeAutoScalingGroups"
],
"Resource": "*"
},
{
"Sid": "OceanBaseActionsOnTaggedResources",
"Effect": "Allow",
"Action": [
"autoscaling:DetachInstances",
"ec2:AcceptVpcEndpointConnections",
"ec2:AcceptVpcPeeringConnection",
"ec2:AssociateIamInstanceProfile",
"ec2:AssociateNatGatewayAddress",
"ec2:AssociateRouteTable",
"ec2:AttachVolume",
"ec2:CreateReplaceRootVolumeTask",
"ec2:DeleteNatGateway",
"ec2:DeleteSecurityGroup",
"ec2:DeleteSubnet",
"ec2:DeleteVolume",
"ec2:DeleteVpc",
"ec2:DeleteVpcEndpointServiceConfigurations",
"ec2:DeleteVpcPeeringConnection",
"ec2:DetachVolume",
"ec2:DisassociateNatGatewayAddress",
"ec2:DisassociateRouteTable",
"ec2:ModifyInstanceAttribute",
"ec2:ModifyVolume",
"ec2:ModifyVpcAttribute",
"ec2:ModifyVpcEndpointServiceConfiguration",
"ec2:ModifyVpcEndpointServicePermissions",
"ec2:RebootInstances",
"ec2:RejectVpcEndpointConnections",
"ec2:ReleaseAddress",
"ec2:ReplaceIamInstanceProfileAssociation",
"ec2:StartInstances",
"ec2:StartVpcEndpointServicePrivateDnsVerification",
"ec2:StopInstances",
"ec2:TerminateInstances",
"elasticloadbalancing:DeleteListener",
"elasticloadbalancing:DeleteLoadBalancer",
"elasticloadbalancing:DeleteTargetGroup",
"elasticloadbalancing:DeregisterTargets",
"elasticloadbalancing:ModifyLoadBalancerAttributes",
"elasticloadbalancing:ModifyTargetGroupAttributes",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:SetSubnets",
"eks:DeleteCluster",
"eks:DeleteNodegroup",
"eks:ListPodIdentityAssociations",
"eks:CreatePodIdentityAssociation",
"eks:UpdateNodegroupConfig",
"elasticfilesystem:CreateMountTarget",
"elasticfilesystem:DeleteFileSystem",
"elasticfilesystem:DeleteMountTarget"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/ob.sys.cloud_pattern": "byoc"
}
}
},
{
"Sid": "OceanBaseTagOperations",
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:DeleteTags",
"elasticloadbalancing:AddTags",
"elasticloadbalancing:RemoveTags",
"eks:TagResource",
"eks:UntagResource",
"elasticfilesystem:TagResource",
"elasticfilesystem:UntagResource",
"autoscaling:CreateOrUpdateTags",
"autoscaling:DeleteTags",
"tag:GetResources",
"tag:TagResources",
"tag:UntagResources"
],
"Resource": "*"
},
{
"Sid": "OceanBaseSendSsmDocuments",
"Effect": "Allow",
"Action": "ssm:SendCommand",
"Resource": [
"arn:aws:ssm:*::document/*",
"arn:aws:ssm:*:*:document/*"
]
},
{
"Sid": "OceanBaseSendCommandToTaggedInstances",
"Effect": "Allow",
"Action": "ssm:SendCommand",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringEquals": {
"ssm:resourceTag/ob.sys.cloud_pattern": "byoc"
}
}
},
{
"Sid": "OceanBaseReadIamRolesAndInstanceProfiles",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:GetInstanceProfile"
],
"Resource": [
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/*",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:instance-profile/*"
]
},
{
"Sid": "OceanBasePassRolesToRequiredServices",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "*",
"Condition": {
"StringEquals": {
"iam:PassedToService": [
"ec2.amazonaws.com",
"eks.amazonaws.com"
]
}
}
},
{
"Sid": "OceanBaseCreateRequiredServiceLinkedRoles",
"Effect": "Allow",
"Action": "iam:CreateServiceLinkedRole",
"Resource": "*",
"Condition": {
"StringEquals": {
"iam:AWSServiceName": [
"eks.amazonaws.com",
"eks-nodegroup.amazonaws.com",
"elasticloadbalancing.amazonaws.com",
"ec2-nat-gateway.amazonaws.com"
]
}
}
},
{
"Sid": "OceanBaseCreateAndAttachPoliciesToIamRoles",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:AttachRolePolicy"
],
"Resource": [
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/AmazonSSMRoleForInstancesQuickSetup",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/OceanBaseBYOCEKSClusterRole",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/OceanBaseBYOCEKSNodeRole",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/AmazonEKS_EBS_CSI_DriverRole",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/AmazonEKSLoadBalancerControllerRole"
]
},
{
"Sid": "OceanBaseCreateAndBindIamInstanceProfiles",
"Effect": "Allow",
"Action": [
"iam:CreateInstanceProfile",
"iam:AddRoleToInstanceProfile"
],
"Resource": [
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:instance-profile/AmazonSSMRoleForInstancesQuickSetup",
"arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:instance-profile/OceanBaseBYOCEKSNodeRole"
]
},
{
"Sid": "OceanBaseReadLoadBalancerControllerPolicy",
"Effect": "Allow",
"Action": [
"iam:GetPolicy",
"iam:GetPolicyVersion"
],
"Resource": "arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:policy/AWSLoadBalancerControllerIAMPolicy"
},
{
"Sid": "OceanBaseCreateLoadBalancerControllerPolicy",
"Effect": "Allow",
"Action": "iam:CreatePolicy",
"Resource": "arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:policy/AWSLoadBalancerControllerIAMPolicy"
},
{
"Sid": "OceanBasePassEbsCsiRoleToPodIdentity",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/AmazonEKS_EBS_CSI_DriverRole",
"Condition": {
"StringEquals": {
"iam:PassedToService": "pods.eks.amazonaws.com"
}
}
},
{
"Sid": "OceanBasePassLbcRoleToPodIdentity",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::<CUSTOMER_AWS_ACCOUNT_ID>:role/AmazonEKSLoadBalancerControllerRole",
"Condition": {
"StringEquals": {
"iam:PassedToService": "pods.eks.amazonaws.com"
}
}
},
{
"Sid": "OceanBaseListS3Buckets",
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
},
{
"Sid": "OceanBaseS3Access",
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::<BYOC_BUCKET_NAME>",
"arn:aws:s3:::<BYOC_BUCKET_NAME>/*"
]
}
]
}
Trust policy: Corresponds to the trusted entity and external ID configured when creating a role, which can be used to verify the role's trust relationships. Please replace <OCEANBASE_AWS_ACCOUNT_ID> with the root account ID provided in the OceanBase Cloud authorization dialog box, and replace <CUSTOMER_UNIQUE_EXTERNAL_ID> with the External ID provided in the same dialog box.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowOceanBaseAccountToAssumeByocRole",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<OCEANBASE_AWS_ACCOUNT_ID>:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "<CUSTOMER_UNIQUE_EXTERNAL_ID>"
}
}
}
]
}