{"id":1797,"date":"2025-01-09T14:05:08","date_gmt":"2025-01-09T06:05:08","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1797"},"modified":"2025-01-09T14:05:08","modified_gmt":"2025-01-09T06:05:08","slug":"whats-aws-roles-anywhere-and-how-it-works","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1797","title":{"rendered":"What&#8217;s AWS Roles Anywhere and how it works"},"content":{"rendered":"<h3><strong>AWS Roles Anywhere \u662f\u4ec0\u4e48\uff1f<\/strong><\/h3>\n<p><strong>AWS Identity and Access Management (IAM) Roles Anywhere<\/strong> \u662f AWS \u63d0\u4f9b\u7684\u4e00\u9879\u529f\u80fd\uff0c\u5141\u8bb8\u7528\u6237\u7684\u672c\u5730\u670d\u52a1\u5668\u6216\u5916\u90e8\u73af\u5883\uff08\u5982\u79c1\u6709\u4e91\u3001\u6570\u636e\u4e2d\u5fc3\uff09\u4f7f\u7528 <strong>IAM \u89d2\u8272<\/strong> \u6388\u6743\u8bbf\u95ee AWS \u670d\u52a1\uff0c\u800c\u65e0\u9700\u5728\u8fd9\u4e9b\u73af\u5883\u4e2d\u5b58\u50a8\u957f\u671f\u51ed\u8bc1\uff08\u5982\u8bbf\u95ee\u5bc6\u94a5\u548c\u5bc6\u94a5\u5bf9\uff09\u3002<\/p>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u7528\u9014<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>\u8de8\u5e73\u53f0\u7edf\u4e00\u8eab\u4efd\u7ba1\u7406<\/strong>\uff1a<\/p>\n<ul>\n<li>\u4e3a\u975e AWS \u73af\u5883\uff08\u5982\u79c1\u6709\u4e91\u3001\u6570\u636e\u4e2d\u5fc3\uff09\u63d0\u4f9b\u4e0e AWS \u4e91\u8d44\u6e90\u4e00\u81f4\u7684\u8eab\u4efd\u548c\u6743\u9650\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6d88\u9664\u957f\u671f\u51ed\u8bc1\u98ce\u9669<\/strong>\uff1a<\/p>\n<ul>\n<li>\u4e0d\u9700\u8981\u5728\u672c\u5730\u6216\u5916\u90e8\u73af\u5883\u4e2d\u5b58\u50a8\u957f\u671f\u7684 AWS \u5bc6\u94a5\uff0c\u964d\u4f4e\u51ed\u8bc1\u6cc4\u6f0f\u7684\u98ce\u9669\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u5730\u8bbf\u95ee AWS \u670d\u52a1<\/strong>\uff1a<\/p>\n<ul>\n<li>\u672c\u5730\u73af\u5883\u901a\u8fc7\u7b7e\u540d\u7684 X.509 \u8bc1\u4e66\u548c\u4fe1\u4efb\u7b56\u7565\uff0c\u52a8\u6001\u83b7\u5f97 IAM \u89d2\u8272\u7684\u4e34\u65f6\u51ed\u8bc1\uff0c\u7528\u4e8e\u8bbf\u95ee AWS \u670d\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u652f\u6301\u6df7\u5408\u4e91\u67b6\u6784<\/strong>\uff1a<\/p>\n<ul>\n<li>\u9002\u7528\u4e8e\u8de8 AWS \u4e91\u548c\u672c\u5730\u73af\u5883\u7684\u6df7\u5408\u90e8\u7f72\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u5de5\u4f5c\u539f\u7406<\/strong><\/h3>\n<h4><strong>1. \u914d\u7f6e\u4fe1\u4efb\u5173\u7cfb<\/strong><\/h4>\n<ul>\n<li>\u7528\u6237\u5728 AWS \u4e2d\u521b\u5efa IAM \u89d2\u8272\uff0c\u5e76\u5141\u8bb8 AWS Roles Anywhere \u5047\u8bbe\u8be5\u89d2\u8272\u3002<\/li>\n<\/ul>\n<h4><strong>2. \u914d\u7f6e\u4fe1\u4efb\u951a\u70b9<\/strong><\/h4>\n<ul>\n<li>\u4fe1\u4efb\u951a\u70b9\u662f AWS Roles Anywhere \u7528\u6765\u9a8c\u8bc1\u5916\u90e8\u73af\u5883\u7684\u516c\u94a5\u8bc1\u4e66\uff08\u901a\u5e38\u7531\u8ba4\u8bc1\u673a\u6784 CA \u7b7e\u53d1\u7684 X.509 \u8bc1\u4e66\uff09\u3002<\/li>\n<li>\u7528\u6237\u5c06 CA \u7684\u6839\u8bc1\u4e66\u4e0a\u4f20\u5230 AWS Roles Anywhere \u4f5c\u4e3a\u4fe1\u4efb\u951a\u70b9\u3002<\/li>\n<\/ul>\n<h4><strong>3. \u5ba2\u6237\u7aef\u51ed\u8bc1\u8bf7\u6c42<\/strong><\/h4>\n<ul>\n<li>\u672c\u5730\u670d\u52a1\u5668\u6216\u5916\u90e8\u7cfb\u7edf\u4f7f\u7528\u5176\u7b7e\u540d\u7684\u8bc1\u4e66\uff0c\u5411 Roles Anywhere \u670d\u52a1\u8bf7\u6c42\u4e34\u65f6\u51ed\u8bc1\u3002<\/li>\n<\/ul>\n<h4><strong>4. \u9881\u53d1\u4e34\u65f6\u51ed\u8bc1<\/strong><\/h4>\n<ul>\n<li>Roles Anywhere \u9a8c\u8bc1\u8bc1\u4e66\u548c\u4fe1\u4efb\u951a\u70b9\uff0c\u786e\u5b9a\u8bf7\u6c42\u8005\u8eab\u4efd\u3002<\/li>\n<li>\u6839\u636e\u914d\u7f6e\u7684 IAM \u89d2\u8272\u548c\u7b56\u7565\uff0c\u751f\u6210\u4e34\u65f6\u51ed\u8bc1\uff08Access Key\u3001Secret Key \u548c Session Token\uff09\u3002<\/li>\n<\/ul>\n<h4><strong>5. \u8bbf\u95ee AWS \u670d\u52a1<\/strong><\/h4>\n<ul>\n<li>\u4e34\u65f6\u51ed\u8bc1\u88ab\u8fd4\u56de\u7ed9\u672c\u5730\u670d\u52a1\u5668\u3002<\/li>\n<li>\u672c\u5730\u670d\u52a1\u5668\u4f7f\u7528\u8fd9\u4e9b\u51ed\u8bc1\u8bbf\u95ee AWS \u8d44\u6e90\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u6838\u5fc3\u7ec4\u4ef6<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>IAM Role\uff08\u89d2\u8272\uff09<\/strong>:<\/p>\n<ul>\n<li>\u5b9a\u4e49\u54ea\u4e9b\u8d44\u6e90\u53ef\u4ee5\u8bbf\u95ee\u4ee5\u53ca\u5141\u8bb8\u7684\u64cd\u4f5c\u3002<\/li>\n<li>\u914d\u7f6e\u4fe1\u4efb\u7b56\u7565\uff0c\u5141\u8bb8 AWS Roles Anywhere \u5047\u8bbe\u89d2\u8272\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Trust Anchor\uff08\u4fe1\u4efb\u951a\u70b9\uff09<\/strong>:<\/p>\n<ul>\n<li>\u662f AWS \u4e2d\u7684\u4e00\u4e2a\u914d\u7f6e\uff0c\u7528\u6765\u9a8c\u8bc1\u5916\u90e8\u73af\u5883\u7684 X.509 \u8bc1\u4e66\u3002<\/li>\n<li>\u5fc5\u987b\u662f\u53ef\u4fe1\u8ba4\u8bc1\u673a\u6784\uff08CA\uff09\u7684\u6839\u8bc1\u4e66\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Certificate\uff08\u8bc1\u4e66\uff09<\/strong>:<\/p>\n<ul>\n<li>\u672c\u5730\u670d\u52a1\u5668\u6216\u5916\u90e8\u7cfb\u7edf\u4f7f\u7528\u7684 X.509 \u5ba2\u6237\u7aef\u8bc1\u4e66\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>AWS Roles Anywhere \u670d\u52a1<\/strong>:<\/p>\n<ul>\n<li>\u9a8c\u8bc1\u5916\u90e8\u73af\u5883\u7684\u8bc1\u4e66\uff0c\u5e76\u751f\u6210\u4e34\u65f6\u51ed\u8bc1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u4f7f\u7528\u573a\u666f<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>\u672c\u5730\u670d\u52a1\u5668\u8bbf\u95ee AWS \u670d\u52a1<\/strong>:<\/p>\n<ul>\n<li>\u4f01\u4e1a\u6570\u636e\u4e2d\u5fc3\u4e2d\u7684\u670d\u52a1\u5668\u901a\u8fc7 AWS Roles Anywhere \u5b89\u5168\u8bbf\u95ee AWS S3 \u6216\u5176\u4ed6\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6df7\u5408\u4e91\u96c6\u6210<\/strong>:<\/p>\n<ul>\n<li>\u5728\u6df7\u5408\u4e91\u67b6\u6784\u4e2d\uff0c\u79c1\u6709\u4e91\u73af\u5883\u901a\u8fc7 AWS Roles Anywhere \u4e0e AWS \u670d\u52a1\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4e34\u65f6\u51ed\u8bc1\u7ba1\u7406<\/strong>:<\/p>\n<ul>\n<li>\u66ff\u4ee3\u957f\u671f\u5bc6\u94a5\uff08\u5982 Access Key \u548c Secret Key\uff09\u8fdb\u884c\u52a8\u6001\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u914d\u7f6e\u6b65\u9aa4<\/strong><\/h3>\n<h4><strong>1. \u521b\u5efa IAM \u89d2\u8272<\/strong><\/h4>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a IAM \u89d2\u8272\uff0c\u5e76\u914d\u7f6e\u4fe1\u4efb\u7b56\u7565\u5141\u8bb8 AWS Roles Anywhere \u5047\u8bbe\u89d2\u8272\uff1a\n<pre><code class=\"language-json\">{\n\"Version\": \"2012-10-17\",\n\"Statement\": [\n  {\n    \"Effect\": \"Allow\",\n    \"Principal\": {\n      \"Service\": \"rolesanywhere.amazonaws.com\"\n    },\n    \"Action\": \"sts:AssumeRole\"\n  }\n]\n}<\/code><\/pre>\n<\/li>\n<li>\u914d\u7f6e IAM \u7b56\u7565\uff0c\u6388\u4e88\u89d2\u8272\u8bbf\u95ee AWS \u8d44\u6e90\u7684\u6743\u9650\u3002<\/li>\n<\/ul>\n<h4><strong>2. \u914d\u7f6e\u4fe1\u4efb\u951a\u70b9<\/strong><\/h4>\n<ul>\n<li>\u4f7f\u7528 CA \u7684\u6839\u8bc1\u4e66\u521b\u5efa\u4fe1\u4efb\u951a\u70b9\uff1a\n<pre><code class=\"language-bash\">aws rolesanywhere create-trust-anchor \\\n  --name MyTrustAnchor \\\n  --source \"sourceType=AWS_CERTIFICATE_MANAGER,sourceArn=arn:aws:acm:...\"<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4><strong>3. \u4e0b\u8f7d AWS Roles Anywhere \u5ba2\u6237\u7aef<\/strong><\/h4>\n<ul>\n<li>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u5ba2\u6237\u7aef\u5de5\u5177\uff08\u5982 <code>aws_signer<\/code>\uff09\u3002<\/li>\n<li>\u5ba2\u6237\u7aef\u8d1f\u8d23\u751f\u6210\u7b7e\u540d\u7684\u51ed\u8bc1\u8bf7\u6c42\u3002<\/li>\n<\/ul>\n<h4><strong>4. \u672c\u5730\u73af\u5883\u53d1\u8d77\u51ed\u8bc1\u8bf7\u6c42<\/strong><\/h4>\n<ul>\n<li>\u4f7f\u7528\u5ba2\u6237\u7aef\u5de5\u5177\u8bf7\u6c42\u4e34\u65f6\u51ed\u8bc1\uff1a\n<pre><code class=\"language-bash\">aws_signer get-credentials \\\n  --certificate <path_to_certificate> \\\n  --role-arn \"arn:aws:iam::123456789012:role\/MyRole\" \\\n  --trust-anchor-arn \"arn:aws:rolesanywhere::123456789012:trust-anchor\/MyTrustAnchor\"<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4><strong>5. \u4f7f\u7528\u4e34\u65f6\u51ed\u8bc1\u8bbf\u95ee AWS \u670d\u52a1<\/strong><\/h4>\n<ul>\n<li>\u4f7f\u7528\u83b7\u53d6\u7684 Access Key\u3001Secret Key \u548c Session Token \u8bbf\u95ee AWS \u8d44\u6e90\uff1a\n<pre><code class=\"language-bash\">AWS_ACCESS_KEY_ID=AKIA...\nAWS_SECRET_ACCESS_KEY=SECRET...\nAWS_SESSION_TOKEN=TOKEN...\naws s3 ls s3:\/\/my-bucket<\/code><\/pre>\n<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>AWS Roles Anywhere \u7684\u4f18\u52bf<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>\u65e0\u957f\u671f\u51ed\u8bc1<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u9ad8\u5b89\u5168\u6027\uff0c\u907f\u514d\u957f\u671f\u5b58\u50a8 AWS \u51ed\u8bc1\u7684\u98ce\u9669\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u52a8\u6001\u51ed\u8bc1<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b\u6309\u9700\u751f\u6210\u7684\u77ed\u671f\u51ed\u8bc1\uff0c\u589e\u5f3a\u8bbf\u95ee\u63a7\u5236\u7684\u7075\u6d3b\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4fe1\u4efb\u7075\u6d3b<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u57fa\u4e8e CA \u7684\u4fe1\u4efb\u6a21\u578b\uff0c\u6613\u4e8e\u4e0e\u4f01\u4e1a PKI\uff08\u516c\u94a5\u57fa\u7840\u8bbe\u65bd\uff09\u96c6\u6210\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8de8\u5e73\u53f0\u652f\u6301<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u4ece\u4efb\u4f55\u62e5\u6709\u8bc1\u4e66\u7684\u672c\u5730\u7cfb\u7edf\u8bbf\u95ee AWS\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u5408\u89c4<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b\u5bf9\u8bbf\u95ee\u8bf7\u6c42\u7684\u8be6\u7ec6\u65e5\u5fd7\u548c\u5ba1\u6838\u80fd\u529b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>\u603b\u7ed3<\/strong><\/h3>\n<p>AWS Roles Anywhere \u662f AWS \u63d0\u4f9b\u7684\u4e00\u9879\u5b89\u5168\u670d\u52a1\uff0c\u65e8\u5728\u5e2e\u52a9\u7528\u6237\u5728\u672c\u5730\u6216\u975e AWS \u73af\u5883\u4e2d\u5b89\u5168\u5730\u8bbf\u95ee AWS \u8d44\u6e90\u3002\u901a\u8fc7\u4f7f\u7528\u57fa\u4e8e\u8bc1\u4e66\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u52a8\u6001\u51ed\u8bc1\uff0c\u5b83\u5728\u6df7\u5408\u4e91\u548c\u591a\u73af\u5883\u90e8\u7f72\u4e2d\u63d0\u4f9b\u4e86\u4e00\u79cd\u7075\u6d3b\u800c\u9ad8\u6548\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u540c\u65f6\u589e\u5f3a\u4e86\u5b89\u5168\u6027\u548c\u5408\u89c4\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS Roles Anywhere \u662f\u4ec0\u4e48\uff1f AWS Identity and Access Management (IAM) Roles Anywhere \u662f AWS \u63d0\u4f9b\u7684\u4e00\u9879\u529f\u80fd\uff0c\u5141\u8bb8\u7528\u6237\u7684\u672c\u5730\u670d\u52a1\u5668\u6216\u5916\u90e8\u73af\u5883\uff08\u5982\u79c1\u6709\u4e91\u3001\u6570\u636e\u4e2d\u5fc3\uff09\u4f7f\u7528 IAM \u89d2\u8272 \u6388\u6743\u8bbf\u95ee AWS \u670d\u52a1\uff0c\u800c\u65e0\u9700\u5728\u8fd9\u4e9b\u73af\u5883\u4e2d\u5b58\u50a8\u957f\u671f\u51ed\u8bc1\uff08\u5982\u8bbf\u95ee\u5bc6\u94a5\u548c\u5bc6\u94a5\u5bf9\uff09\u3002 AWS Roles Anywhere \u7684\u7528\u9014 \u8de8\u5e73\u53f0\u7edf\u4e00\u8eab\u4efd\u7ba1\u7406\uff1a \u4e3a\u975e AWS \u73af\u5883\uff08\u5982\u79c1\u6709\u4e91\u3001\u6570\u636e\u4e2d\u5fc3\uff09\u63d0\u4f9b\u4e0e AWS \u4e91\u8d44\u6e90\u4e00\u81f4\u7684\u8eab\u4efd\u548c\u6743\u9650\u7ba1\u7406\u3002 \u6d88\u9664\u957f\u671f\u51ed\u8bc1\u98ce\u9669\uff1a \u4e0d\u9700\u8981\u5728\u672c\u5730\u6216\u5916\u90e8\u73af\u5883\u4e2d\u5b58\u50a8\u957f\u671f\u7684 AWS \u5bc6\u94a5\uff0c\u964d\u4f4e\u51ed\u8bc1\u6cc4\u6f0f\u7684\u98ce\u9669\u3002 \u5b89\u5168\u5730\u8bbf\u95ee AWS \u670d\u52a1\uff1a \u672c\u5730\u73af\u5883\u901a\u8fc7\u7b7e\u540d\u7684 X.509 \u8bc1\u4e66\u548c\u4fe1\u4efb\u7b56\u7565\uff0c\u52a8\u6001\u83b7\u5f97 IAM \u89d2\u8272\u7684\u4e34\u65f6\u51ed\u8bc1\uff0c\u7528\u4e8e\u8bbf\u95ee AWS \u670d\u52a1\u3002 \u652f\u6301\u6df7\u5408\u4e91\u67b6\u6784\uff1a \u9002\u7528\u4e8e\u8de8 AWS \u4e91\u548c\u672c\u5730\u73af\u5883\u7684\u6df7\u5408\u90e8\u7f72\u573a\u666f\u3002 AWS Roles Anywhere \u7684\u5de5\u4f5c\u539f\u7406 1. \u914d\u7f6e\u4fe1\u4efb\u5173\u7cfb \u7528\u6237\u5728 [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1797\" title=\"Permanent Link to: What&#8217;s AWS Roles Anywhere and how it works\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1797","post","type-post","status-publish","format-standard","hentry","category-5"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1797"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1797"}],"version-history":[{"count":1,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1797\/revisions"}],"predecessor-version":[{"id":1798,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1797\/revisions\/1798"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}