

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Menyiapkan Amazon Bedrock Marketplace
<a name="setup-amazon-bedrock-marketplace"></a>

Anda dapat menggunakan [kebijakan Amazon Bedrock Full Access](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockFullAccess.html) untuk memberikan izin ke SageMaker AI. Sebaiknya gunakan kebijakan terkelola, tetapi jika Anda tidak dapat menggunakan kebijakan terkelola, pastikan peran IAM Anda memiliki izin berikut.

Berikut ini adalah kebijakan kustom yang direkomendasikan untuk Amazon Bedrock Marketplace. Untuk versi terbaru kebijakan terkelola Amazon Bedrock Full Access, lihat [AmazonBedrockFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockFullAccess.html).

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "BedrockAll",
            "Effect": "Allow",
            "Action": [
                "bedrock:*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "DescribeKey",
            "Effect": "Allow",
            "Action": [
                "kms:DescribeKey"
            ],
            "Resource": "arn:*:kms:*:::*"
        },
        {
            "Sid": "APIsWithAllResourceAccess",
            "Effect": "Allow",
            "Action": [
                "iam:ListRoles",
                "ec2:DescribeVpcs",
                "ec2:DescribeSubnets",
                "ec2:DescribeSecurityGroups"
            ],
            "Resource": "*"
        },
        {
            "Sid": "MarketplaceModelEndpointMutatingAPIs",
            "Effect": "Allow",
            "Action": [
                "sagemaker:CreateEndpoint",
                "sagemaker:CreateEndpointConfig",
                "sagemaker:CreateModel",
                "sagemaker:DeleteEndpoint",
                "sagemaker:UpdateEndpoint"
            ],
            "Resource": [
                "arn:*:sagemaker:*:*:endpoint/*",
                "arn:*:sagemaker:*:*:endpoint-config/*",
                "arn:*:sagemaker:*:*:model/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:CalledViaLast": "bedrock.amazonaws.com"
                }
            }
        },
        {
            "Sid": "BedrockEndpointTaggingOperations",
            "Effect": "Allow",
            "Action": [
                "sagemaker:AddTags",
                "sagemaker:DeleteTags"
            ],
            "Resource": [
                "arn:*:sagemaker:*:*:endpoint/*",
                "arn:*:sagemaker:*:*:endpoint-config/*",
                "arn:*:sagemaker:*:*:model/*"
            ]
        },
        {
            "Sid": "MarketplaceModelEndpointNonMutatingAPIs",
            "Effect": "Allow",
            "Action": [
                "sagemaker:DescribeEndpoint",
                "sagemaker:DescribeEndpointConfig",
                "sagemaker:DescribeModel",
                "sagemaker:DescribeInferenceComponent",
                "sagemaker:ListEndpoints",
                "sagemaker:ListTags"
            ],
            "Resource": [
                "arn:*:sagemaker:*:*:endpoint/*",
                "arn:*:sagemaker:*:*:endpoint-config/*",
                "arn:*:sagemaker:*:*:model/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:CalledViaLast": "bedrock.amazonaws.com"
                }
            }
        },
        {
            "Sid": "BedrockEndpointInvokingOperations",
            "Effect": "Allow",
            "Action": [
                "sagemaker:InvokeEndpoint",
                "sagemaker:InvokeEndpointWithResponseStream"
            ],
            "Resource": [
                "arn:*:sagemaker:*:*:endpoint/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:CalledViaLast": "bedrock.amazonaws.com"
                }
            }
        },
        {
            "Sid": "DiscoveringMarketplaceModel",
            "Effect": "Allow",
            "Action": [
                "sagemaker:DescribeHubContent"
            ],
            "Resource": [
                "arn:*:sagemaker:*:aws:hub-content/SageMakerPublicHub/Model/*",
                "arn:*:sagemaker:*:aws:hub/SageMakerPublicHub"
            ]
        },
        {
            "Sid": "AllowMarketplaceModelsListing",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListHubContents"
            ],
            "Resource": "arn:*:sagemaker:*:aws:hub/SageMakerPublicHub"
        },
        {
            "Sid": "RetrieveSubscribedMarketplaceLicenses",
            "Effect": "Allow",
            "Action": [
                "license-manager:ListReceivedLicenses"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "PassRoleToSageMaker",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:*:iam::*:role/*Sagemaker*ForBedrock*"
            ],
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": [
                        "sagemaker.amazonaws.com",
                        "bedrock.amazonaws.com"
                    ]
                }
            }
        },
        {
            "Sid": "PassRoleToBedrock",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": "arn:*:iam::*:role/*AmazonBedrock*",
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": [
                        "bedrock.amazonaws.com"
                    ]
                }
            }
        }
    ]
}
```

**penting**  
Kebijakan Amazon Bedrock Full Access hanya menyediakan izin ke Amazon Bedrock API. Untuk menggunakan Amazon Bedrock di Konsol Manajemen AWS, peran IAM Anda juga harus memiliki izin berikut:  

```
{
        "Sid": "AllowConsoleS3AccessForBedrockMarketplace",
        "Effect": "Allow",
        "Action": [
          "s3:GetObject",
          "s3:GetBucketCORS",
          "s3:ListBucket",
          "s3:ListBucketVersions",
          "s3:GetBucketLocation"
        ],
        "Resource": "*"
    }
```

Jika Anda menulis kebijakan Anda sendiri, Anda harus menyertakan pernyataan kebijakan yang memungkinkan tindakan Amazon Bedrock Marketplace untuk sumber daya tersebut. Misalnya, kebijakan berikut memungkinkan Amazon Bedrock menggunakan `InvokeModel` operasi untuk model yang telah Anda terapkan ke titik akhir.

------
#### [ JSON ]

****  

```
{
    
        "Version":"2012-10-17",		 	 	 
        "Statement": [
            {
                "Sid": "BedrockAll",
                "Effect": "Allow",
                "Action": [
                    "bedrock:InvokeModel"
                ],
                "Resource": [
                    "arn:aws:bedrock:{{us-east-1}}:{{111122223333}}:marketplace/model-endpoint/all-access"
                ]
            },
            {
                "Sid": "VisualEditor1",
                "Effect": "Allow",
                "Action": ["sagemaker:InvokeEndpoint"],
                "Resource": "arn:aws:sagemaker:{{us-east-1}}:{{111122223333}}:endpoint/*",
                "Condition": {
                    "StringEquals": {
                        "aws:ResourceTag/project": "{{example-project-id}}",
                        "aws:CalledViaLast": "bedrock.amazonaws.com"
                    }
                }
            }
        ]
    
}
```

------

Untuk informasi selengkapnya tentang menyiapkan Amazon Bedrock, lihat[Mulai cepat](getting-started.md).

Anda mungkin ingin menggunakan AWS Key Management Service kunci untuk mengenkripsi titik akhir tempat Anda menerapkan model. Anda harus mengubah kebijakan sebelumnya untuk memiliki izin untuk menggunakan kunci. AWS KMS 

 AWS KMS Kunci juga harus memiliki izin untuk mengenkripsi titik akhir. Anda harus mengubah kebijakan AWS KMS sumber daya untuk mengenkripsi titik akhir. Untuk informasi selengkapnya tentang memodifikasi kebijakan, lihat [Menggunakan kebijakan IAM](https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies) dengan. AWS Key Management Service

 AWS KMS Kunci Anda juga harus memiliki `CreateGrant` izin. Berikut ini adalah contoh izin yang harus ada dalam kebijakan utama.

```
{
"Sid": "Allow access for AmazonSageMaker-ExecutionRole",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/{{SagemakerExecutionRole}}"
},
"Action": "kms:CreateGrant",
"Resource": "*"
}
```

Untuk informasi selengkapnya tentang memberikan izin hibah buat, lihat [ CreateGrant Memberikan](https://docs.aws.amazon.com/kms/latest/developerguide/create-grant-overview.html#grant-creategrant) izin.