-
Notifications
You must be signed in to change notification settings - Fork 32
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
IT-3988: Add role to invoke model and move inline sso policy to managed policy #1277
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
44ecb01
Add role
xschildw 92f7d2f
Move policy from inline to managed
xschildw 425e5f5
Rename stack/policy
xschildw bde215d
Fix per review
xschildw 186507c
Rename stack
xschildw ffdc3e1
Restore inline policy per review
xschildw e5631ba
Create agent role in all accounts per review
xschildw 8cab8d7
Rename output per review
xschildw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -641,18 +641,6 @@ SsoLlmDeveloper: | |
managedPolicies: | ||
- 'arn:aws:iam::aws:policy/AmazonBedrockFullAccess' | ||
- 'arn:aws:iam::aws:policy/AWSCloudFormationFullAccess' | ||
# https://stackoverflow.com/questions/58125181/cloud-formation-cant-upload-template-file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving to a managed policy with the hope we can tweak it manually until we get what we need. Inline, we get an error because it's under AWS control. |
||
inlinePolicy: >- | ||
xschildw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": "s3:*", | ||
"Resource": "arn:aws:s3:::cf-template*" | ||
} | ||
] | ||
} | ||
sessionDuration: 'PT12H' | ||
|
||
# Role for a user that can only access AWS Athena in the Synapse Dev account | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Parameters: | ||
<<: !Include '../_parameters.yaml' | ||
|
||
appName: | ||
Type: String | ||
Default: 'BedrockAgentRole' | ||
|
||
BedrockAgentRole: | ||
Type: update-stacks | ||
Template: ./bedrock-agent-role.yaml | ||
StackName: !Sub '${resourcePrefix}-${appName}-BedrockAgentRole' | ||
DefaultOrganizationBindingRegion: !Ref primaryRegion | ||
DefaultOrganizationBinding: | ||
Account: !Ref SynapseLlmProdAccount |
35 changes: 35 additions & 0 deletions
35
org-formation/745-bedrock-agent-role/bedrock-agent-role.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: Enables executing a Bedrock model | ||
|
||
Resources: | ||
bedrockAgentRole: | ||
Type: AWS::IAM::Role | ||
xschildw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Properties: | ||
AssumeRolePolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: bedrock.amazonaws.com | ||
Action: sts:AssumeRole | ||
Condition: | ||
StringEquals: | ||
aws:SourceAccount: !Ref AWS::AccountId | ||
ArnLike: | ||
aws:SourceArn: !Sub "arn:aws:bedrock:${AWS::Region}:${AWS::AccountId}:agent/*" | ||
Policies: | ||
- PolicyName: bedrockAgentPolicy | ||
PolicyDocument: | ||
Version: "2012-10-17" | ||
Statement: | ||
- Effect: Allow | ||
Action: "bedrock:InvokeModel" | ||
Resource: | ||
- !Sub "arn:aws:bedrock:${AWS::Region}::foundation-model/*" | ||
|
||
Outputs: | ||
BedrockAgentRoleArn: | ||
Description: The ARN of the Bedrock Agent Role | ||
Value: !GetAtt bedrockAgentRole.Arn | ||
Export: | ||
Name: BedrockAgentRoleArn |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zaro0508 , wondering if I should have the policy here or if I should move it as a resource alongside the bedrock agent role below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll notice that existing policy definitions created in here are meant to be applied to all accounts (
Account: '*'
) because some AWS features require us to apply the same policy. If you are intending to apply this to one account then I would say that it's more appropriate to setup this policy with the resource that needs it.