Policies
You can have four types of policies in your AWS organization: service control policies, tag policies, backup policies, and AI services opt-out policies. You can use Takomo to manage all of these.
Policy files
You use policy files to store the policies you want to deploy to your AWS organization. Each policy type has its own directory from where Takomo looks for the policies.
Service control policies
service-control-policies
Tag policies
tag-policies
Backup policies
backup-policies
AI services opt-out policies
ai-services-opt-out-policies
Example
Here's an example of a service control policy that denies everything from regions that are not explicitly allowed. Because it's a service control policy, it needs to be placed into the service-control-policies directory.
Declaring policies
Once you have policy files in the correct directories, you can declare them in the organization configuration. Each policy type has its own property under which you declare the policies.
Service control policies
serviceControlPolicies
Tag policies
tagPolicies
Backup policies
backupPolicies
AI services opt-out policies
aiServicesOptOutPolicies
Each of the above are objects whose keys are policy names and values are configuration for the corresponding policy. The policy name is the file name of the policy file, excluding the file extension.
Example
Here's how you would declare the service control policy we created in the previous example:
AWS managed policies
There is a default service control policy named FullAWSAccess which is managed by AWS. You can't provide your own policy with this name. You can still use this policy with your organizational units and accounts by declaring it with awsManaged: true
. Because AWS manages the policy, you don't need to provide a policy file for it.
Example
Here's how you declare the AWS managed policy:
Attaching policies
You can attach declared policies to OUs and accounts with the following properties.
Service control policies
serviceControlPolicies
Tag policies
tagPolicies
Backup policies
backupPolicies
AI services opt-out policies
aiServicesOptOutPolicies
Each of them accepts a single policy name or a list of policy names. Service control policies behave differently than others policies. If you attach a service control policy to an OU, it is also attached automatically to all OUs and accounts under that OU. If you attach any other policy to an OU, the policy is not attached to OUs and accounts under the first OU, but they inherit the policy instead.
Example
Let's add one backup policy named MyBackups and attach it directly to account 123456789012. Then, we attach the AWS managed default service control policy FullAWSAccess to Root OU, so it will be inherited by all OUs and accounts in the organization. Finally, we want our workload accounts under Root/Workloads OU to be restricted to use only the allowed regions, so we attach the restrict-by-regions policy to it.
Last updated