1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

databricks on AWS deploy手順~その2~

Last updated at Posted at 2020-08-21

はじめに

databricks on AWSをdeployするまでの手順をご紹介したいと思います。
databricks on AWSのdeploy完了までには
databricks側とAWS側でいくつかの登録&設定作業が必要となっているため以下3章に分けてご説明いたします。

  • その1 databricksアカウントの作成
  • その2 AWSアカウントとの連携 ← 今回はここ
  • その3 databricks用S3バケットとの連携

本題

AWSアカウントとの連携方法は

  • クロスアカウントロールを使用する方法
  • アクセスキーを使用する方法

の2種類がありますが、databricks公式サイトではクロスアカウントロールを使用する方法を強く推奨しているので、今回はそちらの方法で進めて行こうと思います。
ここからはAWSアカウントとdatabricksアカウントを使用するので、
両方ログインした状態のページのご用意をお願いいたします。

➀databricksアカウント設定

databricksコンソール画面から、サイドバー内「AWS Account」を選択
「Deploy to AWS using Cross Account Role」にチェック
AWS Regionは「ap-northeast-1:Asia Pacific(Tokyo) Region」を選択
External IDはIAMロール作成時に使用するので、コピーしておいてください
ここまで終えたら一旦AWS側の設定に移ります。
image.png

➁クロスアカウントロールとアクセスポリシーの作成

AWSコンソール画面からIAMサービスのページへ移動します。
(検索欄でIAMと入れれば移動できます。)

画面左部のサイドバーから「ロール」を選択。
image.png

「ロールの作成」をクリック。
「別のAWSアカウント」を選択。
「このロールを使用できるアカウントを指定する」の必要事項欄を埋めていきます。
アカウントID : 414351767826
オプション : 外部IDが必要にチェック
外部ID : 本題➀でコピーしたExternal IDをペースト
3つの記入が済んだら「次のステップ:アクセス権限」をクリック
image.png

何もせず「次のステップ:タグ」をクリック
image.png

何もせず「次のステップ:確認」をクリック
image.png

ロール名を記入して「ロールの作成」をクリック
image.png

IAMの画面に戻り、サイドバーから「ロール」を選択。
ロール一覧内から作成したロールを選択
image.png

画面右にある「インラインポリシーの追加」をクリック
image.png

JSONのタブを選択し、以下コードをコピペ
「ポリシーの確認」をクリック

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1403287045000",
      "Effect": "Allow",
      "Action": [
          "ec2:AssociateDhcpOptions",
          "ec2:AssociateIamInstanceProfile",
          "ec2:AssociateRouteTable",
          "ec2:AttachInternetGateway",
          "ec2:AttachVolume",
          "ec2:AuthorizeSecurityGroupEgress",
          "ec2:AuthorizeSecurityGroupIngress",
          "ec2:CancelSpotInstanceRequests",
          "ec2:CreateDhcpOptions",
          "ec2:CreateInternetGateway",
          "ec2:CreateKeyPair",
          "ec2:CreatePlacementGroup",
          "ec2:CreateRoute",
          "ec2:CreateSecurityGroup",
          "ec2:CreateSubnet",
          "ec2:CreateTags",
          "ec2:CreateVolume",
          "ec2:CreateVpc",
          "ec2:CreateVpcPeeringConnection",
          "ec2:DeleteInternetGateway",
          "ec2:DeleteKeyPair",
          "ec2:DeletePlacementGroup",
          "ec2:DeleteRoute",
          "ec2:DeleteRouteTable",
          "ec2:DeleteSecurityGroup",
          "ec2:DeleteSubnet",
          "ec2:DeleteTags",
          "ec2:DeleteVolume",
          "ec2:DeleteVpc",
          "ec2:DescribeAvailabilityZones",
          "ec2:DescribeIamInstanceProfileAssociations",
          "ec2:DescribeInstanceStatus",
          "ec2:DescribeInstances",
          "ec2:DescribePlacementGroups",
          "ec2:DescribePrefixLists",
          "ec2:DescribeReservedInstancesOfferings",
          "ec2:DescribeRouteTables",
          "ec2:DescribeSecurityGroups",
          "ec2:DescribeSpotInstanceRequests",
          "ec2:DescribeSpotPriceHistory",
          "ec2:DescribeSubnets",
          "ec2:DescribeVolumes",
          "ec2:DescribeVpcs",
          "ec2:DetachInternetGateway",
          "ec2:DisassociateIamInstanceProfile",
          "ec2:ModifyVpcAttribute",
          "ec2:ReplaceIamInstanceProfileAssociation",
          "ec2:RequestSpotInstances",
          "ec2:RevokeSecurityGroupEgress",
          "ec2:RevokeSecurityGroupIngress",
          "ec2:RunInstances",
          "ec2:TerminateInstances"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "iam:CreateServiceLinkedRole",
        "iam:PutRolePolicy"
      ],
      "Resource": "arn:aws:iam::*:role/aws-service-role/spot.amazonaws.com/AWSServiceRoleForEC2Spot",
      "Condition": {
        "StringLike": {
          "iam:AWSServiceName": "spot.amazonaws.com"
        }
      }
    }
  ]
}

image.png

ポリシー名を記入して、「ポリシーの作成」をクリック
image.png

再度ロールのページに戻って、「ロールARN」をコピー
image.png

➂databricksアカウント設定残り

本題➀で使用していたdatabricksの画面に戻ります。
本題➁でコピーしておいたロールARNをペーストして「Next Step」をクリック
image.png

自動的にS3設定画面に移動したら、その2の作業は無事完了です。
image.png

おわりに

今回その2ではAWSアカウントとの連携作業を行いました。
次回その3ではいよいよ最後のS3との連携作業を行います。
引き続き頑張りましょう!
お疲れ様でした。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?