@@ -1778,10 +1778,16 @@ To use Bedrock from a different AWS account, you need to create one IAM role in
17781778- ` GenerativeAiUseCasesStack-APIPredictService `
17791779- ` GenerativeAiUseCasesStack-APIPredictStreamService `
17801780- ` GenerativeAiUseCasesStack-APIGenerateImageService `
1781+ - ` GenerativeAiUseCasesStack-APIGenerateVideoService `
1782+ - ` GenerativeAiUseCasesStack-APIListVideoJobsService `
1783+ - ` GenerativeAiUseCasesStack-SpeechToSpeechTaskService `
1784+ - ` GenerativeAiUseCasesStack-RagKnowledgeBaseRetrieve ` (Only when using Knowledge Base)
1785+ - ` GenerativeAiUseCasesStack-APIGetFileDownloadSigned ` (Only when using Knowledge Base)
17811786
17821787For details on how to specify Principals, refer to: [ AWS JSON Policy Elements: Principal] ( https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html )
17831788
1784- Principal configuration example (set in the different account)
1789+ <details >
1790+ <summary >Principal configuration example (set in the different account)</summary >
17851791
17861792``` json
17871793{
@@ -1794,20 +1800,77 @@ Principal configuration example (set in the different account)
17941800 " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIPredictTitleServiceXXX-XXXXXXXXXXXX" ,
17951801 " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIPredictServiceXXXXXXXX-XXXXXXXXXXXX" ,
17961802 " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIPredictStreamServiceXX-XXXXXXXXXXXX" ,
1797- " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIGenerateImageServiceXX-XXXXXXXXXXXX"
1803+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIGenerateImageServiceXX-XXXXXXXXXXXX" ,
1804+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIGenerateVideoServiceXX-XXXXXXXXXXXX" ,
1805+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIListVideoJobsServiceXX-XXXXXXXXXXXX" ,
1806+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-SpeechToSpeechTaskService-XXXXXXXXXXXX" ,
1807+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-RagKnowledgeBaseRetrieveX-XXXXXXXXXXXX" ,
1808+ " arn:aws:iam::111111111111:role/GenerativeAiUseCasesStack-APIGetFileDownloadSignedU-XXXXXXXXXXXX"
17981809 ]
17991810 },
1800- "Action" : " sts:AssumeRole" ,
1801- "Condition" : {}
1811+ "Action" : " sts:AssumeRole"
18021812 }
18031813 ]
18041814}
18051815```
18061816
1817+ </details >
1818+
1819+ <details >
1820+ <summary >Policy configuration example (set in the different account)</summary >
1821+
1822+ ``` json
1823+ {
1824+ "Version" : " 2012-10-17" ,
1825+ "Statement" : [
1826+ {
1827+ "Sid" : " AllowBedrockInvokeModel" ,
1828+ "Effect" : " Allow" ,
1829+ "Action" : [
1830+ " bedrock:InvokeModel*" ,
1831+ " bedrock:Rerank" ,
1832+ " bedrock:GetInferenceProfile" ,
1833+ " bedrock:GetAsyncInvoke" ,
1834+ " bedrock:ListAsyncInvokes"
1835+ ],
1836+ "Resource" : [" *" ]
1837+ },
1838+ {
1839+ "Sid" : " AllowS3PutObjectToVideoTempBucket" ,
1840+ "Effect" : " Allow" ,
1841+ "Action" : [" s3:PutObject" ],
1842+ "Resource" : [" arn:aws:s3:::<video-temp-bucket-name>/*" ]
1843+ },
1844+ {
1845+ "Sid" : " AllowBedrockRetrieveFromKnowledgeBase" ,
1846+ "Effect" : " Allow" ,
1847+ "Action" : [" bedrock:RetrieveAndGenerate*" , " bedrock:Retrieve*" ],
1848+ "Resource" : [
1849+ " arn:aws:bedrock:<region>:<account-id>:knowledge-base/<knowledge-base-id>"
1850+ ]
1851+ },
1852+ {
1853+ "Sid" : " AllowS3GetPresignedUrl" ,
1854+ "Effect" : " Allow" ,
1855+ "Action" : [" s3:GetObject*" ],
1856+ "Resource" : [" arn:aws:s3:::<knowledge-base-datasource-bucket-name>/*" ]
1857+ }
1858+ ]
1859+ }
1860+ ```
1861+
1862+ </details >
1863+
18071864Set the following parameter:
18081865
18091866- ` crossAccountBedrockRoleArn ` ... The ARN of the IAM role created in advance in the different account
18101867
1868+ When using Knowledge Base, you'll need to include these additional parameters:
1869+
1870+ - ` ragKnowledgeBaseEnabled ` ... Set to ` true ` to enable Knowledge Base
1871+ - ` ragKnowledgeBaseId ` ... Knowledge Base ID created in advance in the different account
1872+ - Knowledge Base must exist in the ` modelRegion `
1873+
18111874** Edit [ parameter.ts] ( /packages/cdk/parameter.ts ) **
18121875
18131876``` typescript
@@ -1816,6 +1879,8 @@ const envs: Record<string, Partial<StackInput>> = {
18161879 dev: {
18171880 crossAccountBedrockRoleArn:
18181881 ' arn:aws:iam::AccountID:role/PreCreatedRoleName' ,
1882+ ragKnowledgeBaseEnabled: true , // Only when using Knowledge Base
1883+ ragKnowledgeBaseId: ' XXXXXXXXXX' , // Only when using Knowledge Base
18191884 },
18201885};
18211886```
@@ -1826,7 +1891,9 @@ const envs: Record<string, Partial<StackInput>> = {
18261891// cdk.json
18271892{
18281893 "context" : {
1829- "crossAccountBedrockRoleArn" : " arn:aws:iam::AccountID:role/PreCreatedRoleName"
1894+ "crossAccountBedrockRoleArn" : " arn:aws:iam::AccountID:role/PreCreatedRoleName" ,
1895+ "ragKnowledgeBaseEnabled" : true , // Only when using Knowledge Base
1896+ "ragKnowledgeBaseId" : " XXXXXXXXXX" // Only when using Knowledge Base
18301897 }
18311898}
18321899```
0 commit comments