Yes, you can use the AWS CLI to create an IAM role for DeepSeek. Here's a detailed guide on how to do it:
Step 1: Install and Configure AWS CLI
First, ensure that you have the AWS CLI installed on your system. You can verify this by running the command:
bash
aws --version
If you haven't installed it yet, you can download it from the AWS website. Once installed, configure your AWS CLI by running:
bash
aws configure
This will prompt you to enter your AWS Access Key ID, Secret Access Key, default region name, and default output format.
Step 2: Create an IAM Role
To create an IAM role using the AWS CLI, you can use the `create-role` command. This command requires a trust policy document that defines which entities can assume the role. For DeepSeek, you might want to allow an AWS service like EC2 or OpenSearch to assume the role.
Here's an example of creating a role named `deepseek-role` with a trust policy that allows EC2 to assume it:
bash
aws iam create-role --role-name deepseek-role --description "Role for DeepSeek" --assume-role-policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}'
Step 3: Attach Policies to the Role
After creating the role, you need to attach policies that grant the necessary permissions. For example, if DeepSeek requires access to S3, you can attach the `AmazonS3ReadOnlyAccess` policy:
bash
aws iam attach-role-policy --role-name deepseek-role --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
If you need custom permissions, you can create a custom policy and attach it similarly.
Step 4: Create an Instance Profile (Optional)
If your role is intended for EC2 instances, you should create an instance profile and attach the role to it:
bash
aws iam create-instance-profile --instance-profile-name deepseek-profile
aws iam add-role-to-instance-profile --instance-profile-name deepseek-profile --role-name deepseek-role
Step 5: Verify the Role
Finally, verify that the role has been created and configured correctly by listing the roles and checking the attached policies:
bash
aws iam list-roles
aws iam list-attached-role-policies --role-name deepseek-role
This process allows you to create and configure an IAM role for DeepSeek using the AWS CLI, ensuring that your application has the necessary permissions to operate within AWS services.
Citations:
[1] https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create.html
[2] https://aws.amazon.com/blogs/big-data/use-deepseek-with-amazon-opensearch-service-vector-database-and-amazon-sagemaker/
[3] https://github.com/opensearch-project/ml-commons/blob/main/docs/tutorials/aws/RAG_with_DeepSeek_R1_model_on_Bedrock.md
[4] https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-role.html
[5] https://www.pulumi.com/blog/run-deepseek-on-aws-ec2-using-pulumi/
[6] https://github.com/opensearch-project/ml-commons/blob/main/docs/tutorials/aws/RAG_with_DeepSeek_R1_model_on_Sagemaker.md
[7] https://docs.aws.amazon.com/cli/latest/reference/iam/create-role.html
[8] https://aws.amazon.com/blogs/machine-learning/deploy-deepseek-r1-distilled-models-on-amazon-sagemaker-using-a-large-model-inference-container/
[9] https://tutorialsdojo.com/deepseek-in-amazon-bedrock-a-comprehensive-demo/