Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currently unable to specify different source account for the AWS::Lambda::Permissions resources #113

Open
visitjonathan opened this issue Nov 10, 2016 · 0 comments

Comments

@visitjonathan
Copy link

We have a case where we have two AWS accounts, and need an event created on a bucket in the first account which triggers a lambda function in second account.
Currently in the project's 'settings.yml' we define the s3 notifications, including the name, lambda function, key_filters and events, but there's no way to specify a source account.

During the build phase, the AWS::Lambda::Permissions resources that are generated for these events look similar to the following:

"S3TriggersApplicationArtefactsPermission": {
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Ref": "<lambda_current_alias>"
},
"Principal": "s3.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::Join": [
"",
[
"arn:aws:s3:::",
"<bucket_name>"
]
]
}
},
"Type": "AWS::Lambda::Permission"
}

This means that the lambda function only grants permissions for events in the current account to invoke it.

We have already set up the necessary trust permissions between our accounts, so by simply editing the generated template's AWS::Lambda::Permission objects to specify the "SourceAccount" value as the proper source account id (rather than the current account) - after the 'build' step but before the 'apply' step - we get the events created on the source bucket successfully.

Is there a way for us to specify the source account in the settings.yml file so that the permissions can allow other accounts to trigger the lambda function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant