{"id":18784,"date":"2020-07-07T13:10:36","date_gmt":"2020-07-07T04:10:36","guid":{"rendered":"https:\/\/www.skyarch.net\/blog\/?p=18784"},"modified":"2020-07-07T13:10:36","modified_gmt":"2020-07-07T04:10:36","slug":"iam%e8%aa%8d%e8%a8%bc%e3%81%a7-rds-proxy-%e6%8e%a5%e7%b6%9a%e3%82%92%e5%88%a9%e7%94%a8%e3%81%99%e3%82%8b%e9%9a%9b%e3%81%af%e8%a8%bc%e6%98%8e%e6%9b%b8%e3%81%ab%e3%81%8a%e6%b0%97%e3%82%92%e3%81%a4","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/iam%e8%aa%8d%e8%a8%bc%e3%81%a7-rds-proxy-%e6%8e%a5%e7%b6%9a%e3%82%92%e5%88%a9%e7%94%a8%e3%81%99%e3%82%8b%e9%9a%9b%e3%81%af%e8%a8%bc%e6%98%8e%e6%9b%b8%e3%81%ab%e3%81%8a%e6%b0%97%e3%82%92%e3%81%a4\/","title":{"rendered":"IAM\u8a8d\u8a3c\u3067 RDS Proxy \u63a5\u7d9a\u3092\u5229\u7528\u3059\u308b\u969b\u306f\u8a3c\u660e\u66f8\u306b\u304a\u6c17\u3092\u3064\u3051\u3066"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>IAM\u8a8d\u8a3c\u3067 RDS Proxy \u3078\u63a5\u7d9a\u3067\u304d\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 -(1)-&gt; Proxy -(2)-&gt; DB\u30af\u30e9\u30b9\u30bf\u30fc\/\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9<\/p>\n<p>(1)\u306fIAM\u8a8d\u8a3c\u3067\u3001(2)\u306fSecrets Manager\u306b\u4fdd\u7ba1\u3055\u308c\u305fID\/Pass\u306b\u3088\u308b\u63a5\u7d9a\u3067\u3059\u3002<br \/>\n\u4e0a\u8a18\u65b9\u6cd5\u3067\u63a5\u7d9a\u3057\u3088\u3046\u3068\u3057\u305f\u3068\u3053\u308d\u4e00\u90e8\u3064\u307e\u3065\u3044\u305f\u90e8\u5206\u304c\u3042\u3063\u305f\u306e\u3067\u7c21\u5358\u306a\u624b\u9806\u3068\u4e00\u7dd2\u306b\u5171\u6709\u3057\u307e\u3059\u3002<\/p>\n<h2>\u624b\u9806<\/h2>\n<h3>Aurora Cluster \u4f5c\u6210<\/h3>\n<p>\u4eca\u56de\u306f Aurora PostgreSQL 10.12 \u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18786\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25.png\" alt=\"\" width=\"782\" height=\"603\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25.png 782w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25-300x231.png 300w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25-768x592.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h45_25-728x561.png 728w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/a>\n<p>Proxy -&gt; Cluster \u9593\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306e\u70ba \u4ee5\u4e0b\u3067\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18787\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10.png\" alt=\"\" width=\"781\" height=\"312\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10.png 781w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10-300x120.png 300w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10-768x307.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h47_10-728x291.png 728w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/a>\n<p>\u3053\u3053\u3067IAM\u8a8d\u8a3c\u3092\u9078\u629e\u3057\u3066\u3082Proxy\u63a5\u7d9a\u306f\u53ef\u80fd\u3067\u3057\u305f\u304c\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306e\u307f\u304c\u63a8\u5968\u8a2d\u5b9a\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/docs.aws.amazon.com\/AmazonRDS\/latest\/AuroraUserGuide\/rds-proxy.html#rds-proxy-connecting-iam\" target=\"_blank\" rel=\"noopener noreferrer\">Connecting to a Proxy Using IAM Authentication<\/a><\/p>\n<blockquote><p>~ make sure that the underlying RDS DB instance or Aurora DB cluster doesn't have IAM enabled.<\/p><\/blockquote>\n<p>\u9069\u5b9c\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u7b49\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u3001DB\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h3>Secrets Manager \u30b7\u30fc\u30af\u30ec\u30c3\u30c8 \u4f5c\u6210<\/h3>\n<p>DB\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u540d\u30fb\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3001\u4f5c\u6210\u3057\u305fDB\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u9078\u629e\u3057\u3066\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-18789\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55-1024x793.png\" alt=\"\" width=\"728\" height=\"564\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55-1024x793.png 1024w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55-300x232.png 300w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55-768x595.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55-728x564.png 728w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h48_55.png 1052w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/a>\n<h3>Proxy \u4f5c\u6210<\/h3>\n<p>IAM\u8a8d\u8a3c\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306fTLS\u5fc5\u9808\u3067\u3059\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18791\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37.png\" alt=\"\" width=\"781\" height=\"541\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37.png 781w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37-300x208.png 300w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37-768x532.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_37-728x504.png 728w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/a>\n<p>\u4f5c\u6210\u3057\u305fDB\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001DB\u30af\u30e9\u30b9\u30bf\u30fc\/\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4f5c\u6210\u4e2d\u306bProxy\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u30bf\u30fc\u30b2\u30c3\u30c8\u30b0\u30eb\u30fc\u30d7\u306e\u8a2d\u5b9a\u3092\u3084\u308a\u76f4\u3055\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18792\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58.png\" alt=\"\" width=\"781\" height=\"391\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58.png 781w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58-300x150.png 300w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58-768x384.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h57_58-728x364.png 728w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/a>\n<p>\u4f5c\u6210\u3057\u305f\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u3092\u9078\u629e\u3057\u3001IAM\u8a8d\u8a3c\u3092\u6709\u52b9\u5316\u3057\u3066Proxy\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18793\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24.png\" alt=\"\" width=\"777\" height=\"893\" srcset=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24.png 777w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24-261x300.png 261w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24-768x883.png 768w, https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2020\/07\/2020-07-07_11h58_24-728x837.png 728w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/a>\n<h3>\u5b9f\u969b\u306b\u63a5\u7d9a\u3057\u3066\u307f\u308b<\/h3>\n<p>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304b\u3089Proxy\u3078\u63a5\u7d9a\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\naws rds generate-db-auth-token (AWS CLI)\u3092\u5b9f\u884c\u3059\u308b\u70ba \u9069\u5b9cIAM\u30ed\u30fc\u30eb\u3092\u5272\u308a\u5f53\u3066\u4e0b\u3055\u3044\u3002<br \/>\n\u4eca\u56de\u306f Amazon Linux 2 \u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>DB\u30b5\u30fc\u30d0\u30fc\u306b\u5408\u308f\u305b\u3066 PostgreSQL 10\u7cfb\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre># amazon-linux-extras install postgresql10\n<\/pre>\n<p>RDS Proxy \u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u5229\u7528\u3057\u3001\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre># export RDSHOST=\"postgresql-proxy.proxy-xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com\"\n# export PGPASSWORD=\"$(aws rds generate-db-auth-token --hostname $RDSHOST --port 5432 --region ap-northeast-1 --username postgres)\"\n<\/pre>\n<p>Proxy \u3078\u306eIAM\u8a8d\u8a3c\u63a5\u7d9a\u306b\u5229\u7528\u3059\u308b\u8a3c\u660e\u66f8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre># wget https:\/\/www.amazontrust.com\/repository\/AmazonRootCA1.pem\n<\/pre>\n<p>dbname\u30fbuser \u3092\u6307\u5b9a\u3057\u3066\u4ee5\u4e0b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001Proxy + IAM\u8a8d\u8a3c\u3092\u5229\u7528\u3057\u3066DB\u30af\u30e9\u30b9\u30bf\u30fc\u3078\u63a5\u7d9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre># psql \"host=$RDSHOST port=5432 sslmode=require sslrootcert=AmazonRootCA1.pem dbname=postgres user=postgres\"\n<\/pre>\n<h2>\u60a9\u3093\u3060\u70b9<\/h2>\n<p>Proxy\u3078\u63a5\u7d9a\u3059\u308b\u70ba\u306e\u8a3c\u660e\u66f8\u306b\u3064\u3044\u3066\u3001\u6700\u521d\u306f<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AmazonRDS\/latest\/UserGuide\/UsingWithRDS.SSL.html\" target=\"_blank\" rel=\"noopener noreferrer\">\u3053\u3061\u3089<\/a>\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a rds-ca-2019-root.pem \u3084 rds-combined-ca-bundle.pem \u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001<\/p>\n<pre>psql: SSL error: certificate verify failed\n<\/pre>\n<p>\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u8a3c\u660e\u66f8\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3053\u306e\u30a8\u30e9\u30fc\u304b\u3089\u660e\u767d\u306a\u306e\u3067\u3059\u304c\u3001\u304b\u306a\u308a\u9577\u3044\u3053\u3068\u30cf\u30de\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<br \/>\n\u307f\u306a\u3055\u3093\u306f\u304a\u6c17\u3092\u3064\u3051\u4e0b\u3055\u3044\uff01<\/p>\n<p><a href=\"https:\/\/docs.aws.amazon.com\/AmazonRDS\/latest\/AuroraUserGuide\/rds-proxy.html#rds-proxy-security\" target=\"_blank\" rel=\"noopener noreferrer\">RDS Proxy Security<\/a><\/p>\n<blockquote><p>For a .pem file that you can use, download the\u00a0<a href=\"https:\/\/www.amazontrust.com\/repository\/AmazonRootCA1.pem\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Root CA 1 trust store<\/a>\u00a0from Amazon Trust Services.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 IAM\u8a8d\u8a3c\u3067 RDS Proxy \u3078\u63a5\u7d9a\u3067\u304d\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002 \u30af\u30e9\u30a4\u30a2\u30f3\u30c8 -(1)-&gt; Proxy -(2)-&gt; DB\u30af\u30e9\u30b9\u30bf\u30fc\/\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9 (1)\u306fIAM\u8a8d\u8a3c\u3067\u3001(&#8230;<\/p>\n","protected":false},"author":60,"featured_media":18796,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/www.skyarch.net\/blog\/?p=18784","footnotes":""},"categories":[20,109],"tags":[],"class_list":{"0":"post-18784","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"category-rds","9":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/18784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=18784"}],"version-history":[{"count":7,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/18784\/revisions"}],"predecessor-version":[{"id":18800,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/18784\/revisions\/18800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/18796"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=18784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=18784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=18784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}