You can setup a cross account IAM role to allow access to your Honeycode workbooks for Lambda functions that are deployed in a different, trusted account. Here is an overview of how the sample code will use the cross account role to access your Honeycode workbook:
The steps to follow are:
- Open the AWS console and login to the account where you are planning to deploy your Lambda functions/sample code
- Copy the 12 digit AWS account id for this account
- Logout from this account
- Login to the AWS account that is connected with your Honeycode team
- Open the AWS IAM console
- Click on Policies and then click on Create policy
- Click on the JSON tab and copy and paste the following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "HoneycodeWorkbookAccess",
"Effect": "Allow",
"Action": "honeycode:*",
"Resource": [
"arn:aws:honeycode:*:*:workbook:workbook/YOUR_WORKBOOK_ID",
"arn:aws:honeycode:*:*:table:workbook/YOUR_WORKBOOK_ID/table/*"
]
}
]
}
- Replace YOUR_WORKBOOK_ID with the Workbook ID that you copied from your Honeycode App
- Enter a name such as MyHoneycodeWorkbookLambdaPolicy for this policy.
- Click on Create Policy
- Click on Roles and click on Create role
- Select Another AWS account and enter the account id that you copied in step 2
- Click on Next:Permissions
- Search for and select the policy that you created in step 9. In this guide we have used the name MyHoneycodeWorkbookLambdaPolicy for the policy
Note: You can also use the managed policy AmazonHoneycodeWorkbookFullAccess instead of creating your own custom policy (steps 6 to 10)if you want to give access to all workbooks in your Honeycode team
- Click on Next:Tags and then Next:Review
- Enter a Role name such as MyHoneycodeWorkbookLambdaRole and click on Create role
- You should see a message that says The role MyHoneycodeWorkbookLambdaRole has been created. Click on the role name in this message to open the role
- Copy the Role ARN. This should in the format
arn:aws:iam::123456789012:role/MyHoneycodeWorkbookLambdaRole. You will be using this value to update crossAcountHoneycodeRoleArn in env.json file in your Honeycode Table API sample code with this value - Logout of this AWS account
- Login back to the account where you will be deploying your sample code including Lamdba using Cloud9 and continue with the rest of the instructions to complete the deployment.
