Contoh Kebijakan Berbasis Identitas AWS CodeStar - AWS CodeStar

Pada 31 Juli 2024, Amazon Web Services (AWS) akan menghentikan dukungan untuk membuat dan melihat AWS CodeStar proyek. Setelah 31 Juli 2024, Anda tidak akan lagi dapat mengakses AWS CodeStar konsol atau membuat proyek baru. Namun, AWS sumber daya yang dibuat oleh AWS CodeStar, termasuk repositori sumber, saluran pipa, dan build Anda, tidak akan terpengaruh oleh perubahan ini dan akan terus berfungsi. AWS CodeStar Koneksi dan AWS CodeStar Pemberitahuan tidak akan terpengaruh oleh penghentian ini.

 

Jika Anda ingin melacak pekerjaan, mengembangkan kode, dan membangun, menguji, dan menyebarkan aplikasi Anda, Amazon CodeCatalyst menyediakan proses memulai yang efisien dan fungsionalitas tambahan untuk mengelola proyek perangkat lunak Anda. Pelajari lebih lanjut tentang fungsionalitas dan harga Amazon CodeCatalyst.

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

Contoh Kebijakan Berbasis Identitas AWS CodeStar

Secara default, IAM pengguna dan peran tidak memiliki izin untuk membuat atau memodifikasi AWS CodeStar sumber daya. Mereka juga tidak dapat melakukan tugas menggunakan AWS Management Console, AWS CLI, atau AWS API. Administrator harus membuat IAM kebijakan yang memberikan izin kepada pengguna dan peran untuk melakukan API operasi tertentu pada sumber daya tertentu yang mereka butuhkan. Administrator kemudian harus melampirkan kebijakan tersebut ke IAM pengguna atau grup yang memerlukan izin tersebut.

Untuk mempelajari cara membuat kebijakan IAM berbasis identitas menggunakan contoh dokumen kebijakan ini, lihat Membuat JSON Kebijakan di JSON Tab di Panduan Pengguna. IAM

Praktik Terbaik Kebijakan

Kebijakan berbasis identitas menentukan apakah seseorang dapat membuat, mengakses, atau menghapus AWS CodeStar sumber daya di akun Anda. Tindakan ini membuat Akun AWS Anda dikenai biaya. Ketika Anda membuat atau mengedit kebijakan berbasis identitas, ikuti panduan dan rekomendasi ini:

  • Mulailah dengan kebijakan AWS terkelola dan beralih ke izin hak istimewa paling sedikit — Untuk mulai memberikan izin kepada pengguna dan beban kerja Anda, gunakan kebijakan AWS terkelola yang memberikan izin untuk banyak kasus penggunaan umum. Mereka tersedia di Anda Akun AWS. Kami menyarankan Anda mengurangi izin lebih lanjut dengan menentukan kebijakan yang dikelola AWS pelanggan yang khusus untuk kasus penggunaan Anda. Untuk informasi selengkapnya, lihat kebijakan AWSAWS terkelola atau kebijakan terkelola untuk fungsi pekerjaan di Panduan IAM Pengguna.

  • Menerapkan izin hak istimewa paling sedikit — Saat Anda menetapkan izin dengan IAM kebijakan, berikan hanya izin yang diperlukan untuk melakukan tugas. Anda melakukannya dengan mendefinisikan tindakan yang dapat diambil pada sumber daya tertentu dalam kondisi tertentu, yang juga dikenal sebagai izin dengan hak akses paling rendah. Untuk informasi selengkapnya tentang penggunaan IAM untuk menerapkan izin, lihat Kebijakan dan izin IAM di IAM Panduan Pengguna.

  • Gunakan ketentuan dalam IAM kebijakan untuk membatasi akses lebih lanjut — Anda dapat menambahkan kondisi ke kebijakan Anda untuk membatasi akses ke tindakan dan sumber daya. Misalnya, Anda dapat menulis kondisi kebijakan untuk menentukan bahwa semua permintaan harus dikirim menggunakanSSL. Anda juga dapat menggunakan ketentuan untuk memberikan akses ke tindakan layanan jika digunakan melalui yang spesifik Layanan AWS, seperti AWS CloudFormation. Untuk informasi selengkapnya, lihat elemen IAM JSON kebijakan: Kondisi dalam Panduan IAM Pengguna.

  • Gunakan IAM Access Analyzer untuk memvalidasi IAM kebijakan Anda guna memastikan izin yang aman dan fungsional — IAM Access Analyzer memvalidasi kebijakan baru dan yang sudah ada sehingga kebijakan mematuhi bahasa IAM kebijakan () JSON dan praktik terbaik. IAM IAMAccess Analyzer menyediakan lebih dari 100 pemeriksaan kebijakan dan rekomendasi yang dapat ditindaklanjuti untuk membantu Anda membuat kebijakan yang aman dan fungsional. Untuk informasi selengkapnya, lihat Validasi kebijakan IAM Access Analyzer di IAMPanduan Pengguna.

  • Memerlukan otentikasi multi-faktor (MFA) - Jika Anda memiliki skenario yang mengharuskan IAM pengguna atau pengguna root di dalam Anda Akun AWS, aktifkan MFA untuk keamanan tambahan. Untuk meminta MFA kapan API operasi dipanggil, tambahkan MFA kondisi ke kebijakan Anda. Untuk informasi selengkapnya, lihat Mengonfigurasi API akses MFA yang dilindungi di IAMPanduan Pengguna.

Untuk informasi selengkapnya tentang praktik terbaik diIAM, lihat Praktik terbaik keamanan IAM di Panduan IAM Pengguna.

AWSCodeStarServiceRole Kebijakan

aws-codestar-service-roleKebijakan ini dilampirkan pada peran layanan yang memungkinkan AWS CodeStar untuk melakukan tindakan dengan layanan lain. Saat pertama kali masuk AWS CodeStar, Anda membuat peran layanan. Anda hanya perlu membuatnya sekali. Kebijakan secara otomatis dilampirkan ke peran layanan setelah Anda membuatnya.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ProjectEventRules", "Effect": "Allow", "Action": [ "events:PutTargets", "events:RemoveTargets", "events:PutRule", "events:DeleteRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:*:*:rule/awscodestar-*" ] }, { "Sid": "ProjectStack", "Effect": "Allow", "Action": [ "cloudformation:*Stack*", "cloudformation:CreateChangeSet", "cloudformation:ExecuteChangeSet", "cloudformation:DeleteChangeSet", "cloudformation:GetTemplate" ], "Resource": [ "arn:aws:cloudformation:*:*:stack/awscodestar-*", "arn:aws:cloudformation:*:*:stack/awseb-*", "arn:aws:cloudformation:*:*:stack/aws-cloud9-*", "arn:aws:cloudformation:*:aws:transform/CodeStar*" ] }, { "Sid": "ProjectStackTemplate", "Effect": "Allow", "Action": [ "cloudformation:GetTemplateSummary", "cloudformation:DescribeChangeSet" ], "Resource": "*" }, { "Sid": "ProjectQuickstarts", "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::awscodestar-*/*" ] }, { "Sid": "ProjectS3Buckets", "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::aws-codestar-*", "arn:aws:s3:::elasticbeanstalk-*" ] }, { "Sid": "ProjectServices", "Effect": "Allow", "Action": [ "codestar:*", "codecommit:*", "codepipeline:*", "codedeploy:*", "codebuild:*", "autoscaling:*", "cloudwatch:Put*", "ec2:*", "elasticbeanstalk:*", "elasticloadbalancing:*", "iam:ListRoles", "logs:*", "sns:*", "cloud9:CreateEnvironmentEC2", "cloud9:DeleteEnvironment", "cloud9:DescribeEnvironment*", "cloud9:ListEnvironments" ], "Resource": "*" }, { "Sid": "ProjectWorkerRoles", "Effect": "Allow", "Action": [ "iam:AttachRolePolicy", "iam:CreateRole", "iam:DeleteRole", "iam:DeleteRolePolicy", "iam:DetachRolePolicy", "iam:GetRole", "iam:PassRole", "iam:GetRolePolicy", "iam:PutRolePolicy", "iam:SetDefaultPolicyVersion", "iam:CreatePolicy", "iam:DeletePolicy", "iam:AddRoleToInstanceProfile", "iam:CreateInstanceProfile", "iam:DeleteInstanceProfile", "iam:RemoveRoleFromInstanceProfile" ], "Resource": [ "arn:aws:iam::*:role/CodeStarWorker*", "arn:aws:iam::*:policy/CodeStarWorker*", "arn:aws:iam::*:instance-profile/awscodestar-*" ] }, { "Sid": "ProjectTeamMembers", "Effect": "Allow", "Action": [ "iam:AttachUserPolicy", "iam:DetachUserPolicy" ], "Resource": "*", "Condition": { "ArnEquals": { "iam:PolicyArn": [ "arn:aws:iam::*:policy/CodeStar_*" ] } } }, { "Sid": "ProjectRoles", "Effect": "Allow", "Action": [ "iam:CreatePolicy", "iam:DeletePolicy", "iam:CreatePolicyVersion", "iam:DeletePolicyVersion", "iam:ListEntitiesForPolicy", "iam:ListPolicyVersions", "iam:GetPolicy", "iam:GetPolicyVersion" ], "Resource": [ "arn:aws:iam::*:policy/CodeStar_*" ] }, { "Sid": "InspectServiceRole", "Effect": "Allow", "Action": [ "iam:ListAttachedRolePolicies" ], "Resource": [ "arn:aws:iam::*:role/aws-codestar-service-role", "arn:aws:iam::*:role/service-role/aws-codestar-service-role" ] }, { "Sid": "IAMLinkRole", "Effect": "Allow", "Action": [ "iam:CreateServiceLinkedRole" ], "Resource": "*", "Condition": { "StringEquals": { "iam:AWSServiceName": "cloud9.amazonaws.com" } } }, { "Sid": "DescribeConfigRuleForARN", "Effect": "Allow", "Action": [ "config:DescribeConfigRules" ], "Resource": [ "*" ] }, { "Sid": "ProjectCodeStarConnections", "Effect": "Allow", "Action": [ "codestar-connections:UseConnection", "codestar-connections:GetConnection" ], "Resource": "*" }, { "Sid": "ProjectCodeStarConnectionsPassConnections", "Effect": "Allow", "Action": "codestar-connections:PassConnection", "Resource": "*", "Condition": { "StringEqualsIfExists": { "codestar-connections:PassedToService": "codepipeline.amazonaws.com" } } } ] }

AWSCodeStarFullAccess Kebijakan

Dalam Menyiapkan AWS CodeStar instruksi, Anda melampirkan kebijakan yang diberi nama AWSCodeStarFullAccess kepada IAM pengguna Anda. Pernyataan kebijakan ini memungkinkan pengguna untuk melakukan semua tindakan yang tersedia AWS CodeStar dengan semua AWS CodeStar sumber daya yang tersedia yang terkait dengan AWS akun. Ini termasuk membuat dan menghapus proyek. Contoh berikut adalah cuplikan kebijakan perwakilanAWSCodeStarFullAccess. Kebijakan sebenarnya berbeda tergantung pada templat yang Anda pilih saat memulai AWS CodeStar proyek baru.

AWS CloudFormation memerlukan cloudformation::ListStacks izin saat memanggil cloudformation::DescribeStacks tanpa tumpukan target.

Detail izin

Kebijakan ini mencakup izin untuk melakukan hal berikut:

  • ec2—Ambil informasi tentang EC2 instance untuk membuat proyek. AWS CodeStar

  • cloud9—Ambil informasi tentang AWS Command Line Interface lingkungan.

  • cloudformation—Ambil informasi tentang tumpukan AWS CodeStar proyek.

  • codestarMelakukan tindakan dalam sebuah AWS CodeStar proyek.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "CodeStarEC2", "Effect": "Allow", "Action": [ "codestar:*", "ec2:DescribeKeyPairs", "ec2:DescribeVpcs", "ec2:DescribeSubnets", "cloud9:DescribeEnvironment*" ], "Resource": "*" }, { "Sid": "CodeStarCF", "Effect": "Allow", "Action": [ "cloudformation:DescribeStack*", "cloudformation:ListStacks*", "cloudformation:GetTemplateSummary" ], "Resource": [ "arn:aws:cloudformation:*:*:stack/awscodestar-*" ] } ] }

Anda mungkin tidak ingin memberi semua pengguna akses sebanyak ini. Sebagai gantinya, Anda dapat menambahkan izin tingkat proyek menggunakan peran proyek yang dikelola oleh. AWS CodeStar Peran tersebut memberikan tingkat akses spesifik ke AWS CodeStar proyek dan diberi nama sebagai berikut:

  • Pemilik

  • Kontributor

  • Orang yang melihat

AWS CodeStar Kebijakan Peran Pemilik

Kebijakan peran AWS CodeStar pemilik memungkinkan pengguna untuk melakukan semua tindakan dalam AWS CodeStar proyek tanpa batasan. AWS CodeStar menerapkan CodeStar_project-id_Owner kebijakan untuk anggota tim proyek dengan tingkat akses pemilik..

... { "Effect": "Allow", "Action": [ ... "codestar:*", ... ], "Resource": [ "arn:aws:codestar:us-east-2:111111111111:project/project-id", "arn:aws:iam::account-id:policy/CodeStar_project-id_Owner" ] }, { "Effect": "Allow", "Action": [ "codestar:DescribeUserProfile", "codestar:ListProjects", "codestar:ListUserProfiles", "codestar:VerifyServiceRole", ... ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "codestar:*UserProfile", ... ], "Resource": [ "arn:aws:iam::account-id:user/user-name" ] } ...

AWS CodeStarKebijakan Peran Kontributor

Kebijakan peran AWS CodeStar kontributor memungkinkan pengguna untuk berkontribusi pada proyek dan mengubah dasbor proyek. AWS CodeStar menerapkan CodeStar_project-id_Contributor kebijakan untuk anggota tim proyek dengan tingkat akses kontributor. Pengguna dengan akses kontributor dapat berkontribusi pada proyek dan mengubah dasbor proyek, tetapi tidak dapat menambah atau menghapus anggota tim.

... { "Effect": "Allow", "Action": [ ... "codestar:Describe*", "codestar:Get*", "codestar:List*", "codestar:PutExtendedAccess", ... ], "Resource": [ "arn:aws:codestar:us-east-2:111111111111:project/project-id", "arn:aws:iam::account-id:policy/CodeStar_project-id_Contributor" ] }, { "Effect": "Allow", "Action": [ "codestar:DescribeUserProfile", "codestar:ListProjects", "codestar:ListUserProfiles", "codestar:VerifyServiceRole", ... ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "codestar:*UserProfile", ... ], "Resource": [ "arn:aws:iam::account-id:user/user-name" ] } ...

AWS CodeStar Kebijakan Peran Penampil

Kebijakan peran AWS CodeStar penampil memungkinkan pengguna untuk melihat proyek AWS CodeStar. AWS CodeStar menerapkan CodeStar_project-id_Viewer kebijakan tersebut kepada anggota tim proyek dengan tingkat akses penampil. Pengguna dengan akses penampil dapat melihat proyek AWS CodeStar, tetapi tidak mengubah sumber dayanya atau menambah atau menghapus anggota tim.

... { "Effect": "Allow", "Action": [ ... "codestar:Describe*", "codestar:Get*", "codestar:List*", ... ], "Resource": [ "arn:aws:codestar:us-east-2:111111111111:project/project-id", "arn:aws:iam::account-id:policy/CodeStar_project-id_Viewer" ] }, { "Effect": "Allow", "Action": [ "codestar:DescribeUserProfile", "codestar:ListProjects", "codestar:ListUserProfiles", "codestar:VerifyServiceRole", ... ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "codestar:*UserProfile", ... ], "Resource": [ "arn:aws:iam::account-id:user/user-name" ] } ...

AWS CodeStar Kebijakan Peran Pekerja Toolchain (Setelah 6 Desember 2018) PDT

Untuk AWS CodeStar proyek yang dibuat setelah 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran pekerja yang menciptakan sumber daya untuk proyek Anda di AWS layanan lain. Isi kebijakan tergantung pada jenis proyek yang Anda buat. Kebijakan berikut adalah contohnya. Untuk informasi selengkapnya, lihat IAMKebijakan untuk Peran Pekerja.

{ "Statement": [ { "Action": [ "s3:GetObject", "s3:GetObjectVersion", "s3:GetBucketVersioning", "s3:PutObject*", "codecommit:CancelUploadArchive", "codecommit:GetBranch", "codecommit:GetCommit", "codecommit:GetUploadArchiveStatus", "codecommit:GitPull", "codecommit:UploadArchive", "codebuild:StartBuild", "codebuild:BatchGetBuilds", "codebuild:StopBuild", "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "cloudformation:DescribeStacks", "cloudformation:DescribeChangeSet", "cloudformation:CreateChangeSet", "cloudformation:DeleteChangeSet", "cloudformation:ExecuteChangeSet", "codepipeline:StartPipelineExecution", "lambda:ListFunctions", "lambda:InvokeFunction", "sns:Publish" ], "Resource": [ "*" ], "Effect": "Allow" }, { "Action": [ "iam:PassRole" ], "Resource": [ "*" ], "Effect": "Allow" }, { "Action": [ "kms:GenerateDataKey*", "kms:Encrypt", "kms:Decrypt" ], "Resource": [ "*" ], "Effect": "Allow" } ] }

AWS CloudFormation Kebijakan Peran Pekerja

Untuk AWS CodeStar proyek yang dibuat setelah 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran pekerja yang membuat AWS CloudFormation sumber daya untuk AWS CodeStar proyek Anda. Isi kebijakan tergantung pada jenis sumber daya yang diperlukan untuk proyek Anda. Kebijakan berikut adalah contohnya. Untuk informasi selengkapnya, lihat IAMKebijakan untuk Peran Pekerja.

{ { "Statement": [ { "Action": [ "s3:PutObject", "s3:GetObject", "s3:GetObjectVersion" ], "Resource": [ "arn:aws:s3:::aws-codestar-region-id-account-id-project-id", "arn:aws:s3:::aws-codestar-region-id-account-id-project-id/*" ], "Effect": "Allow" }, { "Action": [ "apigateway:DELETE", "apigateway:GET", "apigateway:PATCH", "apigateway:POST", "apigateway:PUT", "codedeploy:CreateApplication", "codedeploy:CreateDeployment", "codedeploy:CreateDeploymentConfig", "codedeploy:CreateDeploymentGroup", "codedeploy:DeleteApplication", "codedeploy:DeleteDeployment", "codedeploy:DeleteDeploymentConfig", "codedeploy:DeleteDeploymentGroup", "codedeploy:GetDeployment", "codedeploy:GetDeploymentConfig", "codedeploy:GetDeploymentGroup", "codedeploy:RegisterApplicationRevision", "codestar:SyncResources", "config:DeleteConfigRule", "config:DescribeConfigRules", "config:ListTagsForResource", "config:PutConfigRule", "config:TagResource", "config:UntagResource", "dynamodb:CreateTable", "dynamodb:DeleteTable", "dynamodb:DescribeContinuousBackups", "dynamodb:DescribeTable", "dynamodb:DescribeTimeToLive", "dynamodb:ListTagsOfResource", "dynamodb:TagResource", "dynamodb:UntagResource", "dynamodb:UpdateContinuousBackups", "dynamodb:UpdateTable", "dynamodb:UpdateTimeToLive", "ec2:AssociateIamInstanceProfile", "ec2:AttachVolume", "ec2:CreateSecurityGroup", "ec2:createTags", "ec2:DescribeIamInstanceProfileAssociations", "ec2:DescribeInstances", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DetachVolume", "ec2:DisassociateIamInstanceProfile", "ec2:ModifyInstanceAttribute", "ec2:ModifyInstanceCreditSpecification", "ec2:ModifyInstancePlacement", "ec2:MonitorInstances", "ec2:ReplaceIamInstanceProfileAssociation", "ec2:RunInstances", "ec2:StartInstances", "ec2:StopInstances", "ec2:TerminateInstances", "events:DeleteRule", "events:DescribeRule", "events:ListTagsForResource", "events:PutRule", "events:PutTargets", "events:RemoveTargets", "events:TagResource", "events:UntagResource", "kinesis:AddTagsToStream", "kinesis:CreateStream", "kinesis:DecreaseStreamRetentionPeriod", "kinesis:DeleteStream", "kinesis:DescribeStream", "kinesis:IncreaseStreamRetentionPeriod", "kinesis:RemoveTagsFromStream", "kinesis:StartStreamEncryption", "kinesis:StopStreamEncryption", "kinesis:UpdateShardCount", "lambda:CreateAlias", "lambda:CreateFunction", "lambda:DeleteAlias", "lambda:DeleteFunction", "lambda:DeleteFunctionConcurrency", "lambda:GetFunction", "lambda:GetFunctionConfiguration", "lambda:ListTags", "lambda:ListVersionsByFunction", "lambda:PublishVersion", "lambda:PutFunctionConcurrency", "lambda:TagResource", "lambda:UntagResource", "lambda:UpdateAlias", "lambda:UpdateFunctionCode", "lambda:UpdateFunctionConfiguration", "s3:CreateBucket", "s3:DeleteBucket", "s3:DeleteBucketWebsite", "s3:PutAccelerateConfiguration", "s3:PutAnalyticsConfiguration", "s3:PutBucketAcl", "s3:PutBucketCORS", "s3:PutBucketLogging", "s3:PutBucketNotification", "s3:PutBucketPublicAccessBlock", "s3:PutBucketVersioning", "s3:PutBucketWebsite", "s3:PutEncryptionConfiguration", "s3:PutInventoryConfiguration", "s3:PutLifecycleConfiguration", "s3:PutMetricsConfiguration", "s3:PutReplicationConfiguration", "sns:CreateTopic", "sns:DeleteTopic", "sns:GetTopicAttributes", "sns:ListSubscriptionsByTopic", "sns:ListTopics", "sns:SetSubscriptionAttributes", "sns:Subscribe", "sns:Unsubscribe", "sqs:CreateQueue", "sqs:DeleteQueue", "sqs:GetQueueAttributes", "sqs:GetQueueUrl", "sqs:ListQueueTags", "sqs:TagQueue", "sqs:UntagQueue" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "lambda:AddPermission", "lambda:RemovePermission" ], "Resource": [ "arn:aws:lambda:region-id:account-id:function:awscodestar-*" ], "Effect": "Allow" }, { "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/CodeStar-project-id*" ], "Effect": "Allow" }, { "Condition": { "StringEquals": { "iam:PassedToService": "codedeploy.amazonaws.com" } }, "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CodeDeploy" ], "Effect": "Allow" }, { "Action": [ "cloudformation:CreateChangeSet" ], "Resource": [ "arn:aws:cloudformation:region-id:aws:transform/Serverless-2016-10-31", "arn:aws:cloudformation:region-id:aws:transform/CodeStar" ], "Effect": "Allow" }, { "Action": [ "iam:CreateServiceLinkedRole", "iam:GetRole", "iam:DeleteRole", "iam:DeleteUser" ], "Resource": "*", "Effect": "Allow" }, { "Condition": { "StringEquals": { "iam:PermissionsBoundary": "arn:aws:iam::account-id:policy/CodeStar_project-id_PermissionsBoundary" } }, "Action": [ "iam:AttachRolePolicy", "iam:AttachUserPolicy", "iam:CreateRole", "iam:CreateUser", "iam:DeleteRolePolicy", "iam:DeleteUserPolicy", "iam:DetachUserPolicy", "iam:DetachRolePolicy", "iam:PutUserPermissionsBoundary", "iam:PutRolePermissionsBoundary" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "kms:CreateKey", "kms:CreateAlias", "kms:DeleteAlias", "kms:DisableKey", "kms:EnableKey", "kms:UpdateAlias", "kms:TagResource", "kms:UntagResource" ], "Resource": "*", "Effect": "Allow" }, { "Condition": { "StringEquals": { "ssm:ResourceTag/awscodestar:projectArn": "arn:aws:codestar:project-id:account-id:project/project-id" } }, "Action": [ "ssm:GetParameter*" ], "Resource": "*", "Effect": "Allow" } ] }

AWS CloudFormation Kebijakan Peran Pekerja (Sebelum 6 Desember 2018PDT)

Jika AWS CodeStar proyek Anda dibuat sebelum 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran AWS CloudFormation pekerja. Pernyataan kebijakan berikut adalah contohnya.

{ "Statement": [ { "Action": [ "s3:PutObject", "s3:GetObject", "s3:GetObjectVersion" ], "Resource": [ "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe/*" ], "Effect": "Allow" }, { "Action": [ "codestar:SyncResources", "lambda:CreateFunction", "lambda:DeleteFunction", "lambda:AddPermission", "lambda:UpdateFunction", "lambda:UpdateFunctionCode", "lambda:GetFunction", "lambda:GetFunctionConfiguration", "lambda:UpdateFunctionConfiguration", "lambda:RemovePermission", "lambda:listTags", "lambda:TagResource", "lambda:UntagResource", "apigateway:*", "dynamodb:CreateTable", "dynamodb:DeleteTable", "dynamodb:DescribeTable", "kinesis:CreateStream", "kinesis:DeleteStream", "kinesis:DescribeStream", "sns:CreateTopic", "sns:DeleteTopic", "sns:ListTopics", "sns:GetTopicAttributes", "sns:SetTopicAttributes", "s3:CreateBucket", "s3:DeleteBucket", "config:DescribeConfigRules", "config:PutConfigRule", "config:DeleteConfigRule", "ec2:*", "autoscaling:*", "elasticloadbalancing:*", "elasticbeanstalk:*" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/CodeStarWorker-project-id-Lambda" ], "Effect": "Allow" }, { "Action": [ "cloudformation:CreateChangeSet" ], "Resource": [ "arn:aws:cloudformation:us-east-1:aws:transform/Serverless-2016-10-31", "arn:aws:cloudformation:us-east-1:aws:transform/CodeStar" ], "Effect": "Allow" } ] }

AWS CodePipeline Kebijakan Peran Pekerja (Sebelum 6 Desember 2018PDT)

Jika AWS CodeStar proyek Anda dibuat sebelum 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran CodePipeline pekerja. Pernyataan kebijakan berikut adalah contohnya.

{ "Statement": [ { "Action": [ "s3:GetObject", "s3:GetObjectVersion", "s3:GetBucketVersioning", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe/*" ], "Effect": "Allow" }, { "Action": [ "codecommit:CancelUploadArchive", "codecommit:GetBranch", "codecommit:GetCommit", "codecommit:GetUploadArchiveStatus", "codecommit:UploadArchive" ], "Resource": [ "arn:aws:codecommit:us-east-1:account-id:project-id" ], "Effect": "Allow" }, { "Action": [ "codebuild:StartBuild", "codebuild:BatchGetBuilds", "codebuild:StopBuild" ], "Resource": [ "arn:aws:codebuild:us-east-1:account-id:project/project-id" ], "Effect": "Allow" }, { "Action": [ "cloudformation:DescribeStacks", "cloudformation:DescribeChangeSet", "cloudformation:CreateChangeSet", "cloudformation:DeleteChangeSet", "cloudformation:ExecuteChangeSet" ], "Resource": [ "arn:aws:cloudformation:us-east-1:account-id:stack/awscodestar-project-id-lambda/*" ], "Effect": "Allow" }, { "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CloudFormation" ], "Effect": "Allow" } ] }

AWS CodeBuild Kebijakan Peran Pekerja (Sebelum 6 Desember 2018PDT)

Jika AWS CodeStar proyek Anda dibuat sebelum 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran CodeBuild pekerja. Pernyataan kebijakan berikut adalah contohnya.

{ "Statement": [ { "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "s3:PutObject", "s3:GetObject", "s3:GetObjectVersion" ], "Resource": [ "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe/*", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-app", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-app/*" ], "Effect": "Allow" }, { "Action": [ "codecommit:GitPull" ], "Resource": [ "arn:aws:codecommit:us-east-1:account-id:project-id" ], "Effect": "Allow" }, { "Action": [ "kms:GenerateDataKey*", "kms:Encrypt", "kms:Decrypt" ], "Resource": [ "arn:aws:kms:us-east-1:account-id:alias/aws/s3" ], "Effect": "Allow" } ] }

Kebijakan Peran Pekerja CloudWatch Acara Amazon (Sebelum 6 Desember 2018PDT)

Jika AWS CodeStar proyek Anda dibuat sebelum 6 Desember 2018PDT, AWS CodeStar buat kebijakan inline untuk peran pekerja CloudWatch Acara. Pernyataan kebijakan berikut adalah contohnya.

{ "Statement": [ { "Action": [ "codepipeline:StartPipelineExecution" ], "Resource": [ "arn:aws:codepipeline:us-east-1:account-id:project-id-Pipeline" ], "Effect": "Allow" } ] }

AWS CodeStar Kebijakan Batas Izin

Jika Anda membuat AWS CodeStar proyek setelah 6 Desember 2018PDT, AWS CodeStar buat kebijakan batas izin untuk proyek Anda. Kebijakan ini mencegah eskalasi hak istimewa untuk sumber daya di luar proyek. Ini adalah kebijakan dinamis yang diperbarui seiring perkembangan proyek. Isi kebijakan tergantung pada jenis proyek yang Anda buat. Kebijakan berikut adalah contohnya. Untuk informasi selengkapnya, lihat IAMBatas Izin.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "1", "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*/AWSLogs/*/Config/*" ] }, { "Sid": "2", "Effect": "Allow", "Action": [ "*" ], "Resource": [ "arn:aws:codestar:us-east-1:account-id:project/project-id", "arn:aws:cloudformation:us-east-1:account-id:stack/awscodestar-project-id-lambda/eefbbf20-c1d9-11e8-8a3a-500c28b4e461", "arn:aws:cloudformation:us-east-1:account-id:stack/awscodestar-project-id/4b80b3f0-c1d9-11e8-8517-500c28b236fd", "arn:aws:codebuild:us-east-1:account-id:project/project-id", "arn:aws:codecommit:us-east-1:account-id:project-id", "arn:aws:codepipeline:us-east-1:account-id:project-id-Pipeline", "arn:aws:execute-api:us-east-1:account-id:7rlst5mrgi", "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CloudFormation", "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CloudWatchEventRule", "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CodeBuild", "arn:aws:iam::account-id:role/CodeStarWorker-project-id-CodePipeline", "arn:aws:iam::account-id:role/CodeStarWorker-project-id-Lambda", "arn:aws:lambda:us-east-1:account-id:function:awscodestar-project-id-lambda-GetHelloWorld-KFKTXYNH9573", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-app", "arn:aws:s3:::aws-codestar-us-east-1-account-id-project-id-pipe" ] }, { "Sid": "3", "Effect": "Allow", "Action": [ "apigateway:GET", "config:Describe*", "config:Get*", "config:List*", "config:Put*", "logs:CreateLogGroup", "logs:CreateLogStream", "logs:DescribeLogGroups", "logs:PutLogEvents" ], "Resource": [ "*" ] } ] }

Daftar Sumber Daya untuk Proyek

Dalam contoh ini, Anda ingin memberikan IAM pengguna tertentu di AWS akun Anda akses untuk membuat daftar sumber daya AWS CodeStar proyek.

{ "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : [ "codestar:ListResources", ], "Resource" : "arn:aws:codestar:us-east-2:project/my-first-projec" } ] }

Menggunakan AWS CodeStar Konsol

Tidak ada izin khusus yang diperlukan untuk mengakses AWS CodeStar konsol, tetapi Anda tidak dapat melakukan apa pun yang berguna kecuali Anda memiliki AWSCodeStarFullAccess kebijakan atau salah satu peran AWS CodeStar tingkat proyek: Pemilik, Kontributor, atau Penampil. Untuk informasi selengkapnya tentang AWSCodeStarFullAccess, lihat AWSCodeStarFullAccess Kebijakan. Untuk informasi selengkapnya tentang kebijakan tingkat proyek, lihat. IAMKebijakan untuk Anggota Tim

Anda tidak perlu mengizinkan izin konsol minimum untuk pengguna yang melakukan panggilan hanya ke AWS CLI atau. AWS API Sebagai gantinya, izinkan akses hanya ke tindakan yang cocok dengan API operasi yang Anda coba lakukan.

Izinkan Pengguna untuk Melihat Izin Mereka Sendiri

Contoh ini menunjukkan cara Anda membuat kebijakan yang memungkinkan IAM pengguna melihat kebijakan sebaris dan terkelola yang dilampirkan pada identitas pengguna mereka. Kebijakan ini mencakup izin untuk menyelesaikan tindakan ini di konsol atau secara terprogram menggunakan atau. AWS CLI AWS API

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] }

Memperbarui AWS CodeStar Proyek

Dalam contoh ini, Anda ingin memberikan IAM pengguna tertentu di AWS akun Anda akses untuk mengedit atribut AWS CodeStar proyek, seperti deskripsi proyeknya.

{ "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : [ "codestar:UpdateProject" ], "Resource" : "arn:aws:codestar:us-east-2:project/my-first-projec" } ] }

Menambahkan Anggota Tim ke Proyek

Dalam contoh ini, Anda ingin memberikan IAM pengguna tertentu kemampuan untuk menambahkan anggota tim ke AWS CodeStar proyek dengan ID proyek my-first-projec, tetapi untuk secara eksplisit menyangkal bahwa pengguna kemampuan untuk menghapus anggota tim:

{ "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : [ "codestar:AssociateTeamMember", ], "Resource" : "arn:aws:codestar:us-east-2:project/my-first-projec" }, { "Effect" : "Deny", "Action" : [ "codestar:DisassociateTeamMember", ], "Resource" : "arn:aws:codestar:us-east-2:project/my-first-projec" } ] ] }

Daftar Profil Pengguna yang Terkait dengan AWS Akun

Dalam contoh ini, Anda mengizinkan IAM pengguna yang memiliki kebijakan ini dilampirkan untuk mencantumkan semua profil AWS CodeStar pengguna yang terkait dengan AWS akun:

{ "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : [ "codestar:ListUserProfiles", ], "Resource" : "*" } ] }

Melihat AWS CodeStar Proyek Berdasarkan Tag

Anda dapat menggunakan kondisi dalam kebijakan berbasis identitas untuk mengontrol akses ke AWS CodeStar proyek berdasarkan tag. Contoh ini menunjukkan bagaimana Anda dapat membuat kebijakan yang memungkinkan melihat proyek. Namun, izin diberikan hanya jika tag Project Owner memiliki nilai nama pengguna pengguna tersebut. Kebijakan ini juga memberi izin yang diperlukan untuk menyelesaikan tindakan ini pada konsol tersebut.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ListProjectsInConsole", "Effect": "Allow", "Action": "codestar:ListProjects", "Resource": "*" }, { "Sid": "ViewProjectIfOwner", "Effect": "Allow", "Action": "codestar:GetProject, "Resource": "arn:aws:codestar:*:*:project/*", "Condition": { "StringEquals": {"codestar:ResourceTag/Owner": "${aws:username}"} } } ] }

Anda dapat melampirkan kebijakan ini ke IAM pengguna di akun Anda. Jika pengguna bernama richard-roe mencoba untuk melihat AWS CodeStar proyek, proyek harus diberi tag Owner=richard-roe atauowner=richard-roe. Jika tidak, aksesnya akan ditolak. Kunci tanda syarat Owner cocok dengan Owner dan owner karena nama kunci syarat tidak terpengaruh huruf besar/kecil. Untuk informasi selengkapnya, lihat Elemen IAM JSON Kebijakan: Kondisi dalam Panduan IAM Pengguna.

AWS CodeStar pembaruan kebijakan AWS terkelola

Lihat detail tentang pembaruan kebijakan AWS terkelola AWS CodeStar sejak layanan ini mulai melacak perubahan ini. Untuk peringatan otomatis tentang perubahan pada halaman ini, berlangganan RSS feed di halaman Riwayat AWS CodeStar dokumen.

Perubahan Deskripsi Tanggal

AWSCodeStarFullAccessKebijakan - Perbarui AWSCodeStarFullAccess kebijakan

Kebijakan peran AWS CodeStar akses telah diperbarui. Hasil dari kebijakan ini sama, tetapi cloudformation membutuhkan ListStacks tambahan DescribeStacks, yang sudah diperlukan.

24 Maret 2023

AWSCodeStarServiceRoleKebijakan - Perbarui AWSCodeStarServiceRole kebijakan

Kebijakan untuk peran AWS CodeStar layanan telah diperbarui untuk memperbaiki tindakan berlebihan dalam pernyataan kebijakan.

Kebijakan peran layanan memungkinkan AWS CodeStar layanan untuk melakukan tindakan atas nama Anda.

September 23, 2021

AWS CodeStar mulai melacak perubahan

AWS CodeStar mulai melacak perubahan untuk kebijakan yang AWS dikelola.

September 23, 2021