> ## Documentation Index
> Fetch the complete documentation index at: https://support.i.moneyforward.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon Web Services (AWS IAM)

> Amazon Web Services (AWS)の連携手順です。マネーフォワード AdminaからAWSへの、管理者のログインから、連携方法まで一連の手順を解説します。

## サポートする機能

<Badge color="blue">アカウント削除</Badge> <Badge color="blue">アカウント作成</Badge>

## 事前準備

### Amazon Web Servicesへのログイン方法

[AWSのログインページ](https://console.aws.amazon.com)にアクセスし、ルートユーザーもしくはIAMユーザーでログインします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1667957723469-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=a86e286beec7183a3a49b8a242cc757d" alt="AWSログイン画面" width="812" height="1196" data-path="images/integrations/dc2mjsw9oy/1667957723469-image.png" />

### 連携用ポリシーの作成方法

1. [Identity and Access Management (IAM)](https://console.aws.amazon.com/iam)にアクセスし、左メニューの**ポリシー**にアクセス、\[**ポリシーの作成**] をクリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710834486770-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=0cd3e2a3e55808f579580603a19d40b3" alt="IAMポリシー画面" width="3054" height="1302" data-path="images/integrations/dc2mjsw9oy/1710834486770-image.png" />

2. ポリシーの作成画面で、`JSON`タブをクリックし、次のスクリプトを上書きします。

ロールの LastActivityを取得する場合、ポリシーのスクリプト"iam:ListRoles",の下に`"iam:GetRole",`を追加します。

```json theme={null}
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Effect": "Allow",
			"Action": [
				"iam:GetAccessKeyLastUsed",
				"iam:ListAccessKeys",
				"iam:ListAttachedUserPolicies",
				"iam:ListGroupsForUser",
				"iam:ListMFADevices",
				"iam:ListRolePolicies",
				"iam:ListRoles",
				"iam:GetRole",
				"iam:ListUsers",
				"iam:ListUserTags",
				"iam:DeleteUser",
				"iam:DeleteAccessKey",
				"iam:DeleteRole",
				"iam:ListAttachedRolePolicies",
				"iam:DetachRolePolicy",
				"iam:DeleteLoginProfile",
				"iam:ListAttachedUserPolicies",
				"iam:DetachUserPolicy",
				"iam:CreateUser",
				"iam:TagUser",
				"iam:ListUserPolicies",
				"account:GetContactInformation"
			],
			"Resource": "*"
		}
	]
}
```

<Tip>
  Adminaからのアカウント削除および、追加する機能が不要な場合（Read Only）、次のスクリプトをご利用ください。

  ロールの LastActivityを取得する場合、ポリシーのスクリプト"iam:ListRoles",の下に`"iam:GetRole",`を追加します。
</Tip>

```json theme={null}
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Effect": "Allow",
			"Action": [
				"iam:GetAccessKeyLastUsed",
				"iam:ListAccessKeys",
				"iam:ListAttachedUserPolicies",
				"iam:ListGroupsForUser",
				"iam:ListMFADevices",
				"iam:ListRolePolicies",
				"iam:ListRoles",
				"iam:GetRole",
				"iam:ListUsers",
				"iam:ListUserTags",
				"iam:ListAttachedRolePolicies",
				"iam:ListAttachedUserPolicies",
				"iam:TagUser",
				"iam:ListUserPolicies",
				"account:GetContactInformation"
			],
			"Resource": "*"
		}
	]
}
```

3. 入力完了後、「**次へ**」をクリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710834614108-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=27e3d3b3a096ba79f0adc005604bd302" alt="ポリシーJSON編集画面" width="3254" height="1850" data-path="images/integrations/dc2mjsw9oy/1710834614108-image.png" />

4. 次の画面で**ポリシー名**に任意の名前を入力し、\[ポリシーの作成]をクリックします。これでポリシーの作成が完了です。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710834732620-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=7277c40e9d03a9ddb4a6588958947401" alt="ポリシー名入力画面" width="2562" height="1774" data-path="images/integrations/dc2mjsw9oy/1710834732620-image.png" />

### 連携用ロールの作成方法

1. [Identity and Access Management (IAM)](https://console.aws.amazon.com/iam)にアクセスし、左メニューの**ロール**にアクセスし、\[**ロールを作成**] をクリックします。

ロールのLastActivityは取得できません。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710834870029-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=bd018f095dbf223ebf4ced2efefe7ec6" alt="IAMロール画面" width="3068" height="820" data-path="images/integrations/dc2mjsw9oy/1710834870029-image.png" />

2. 信頼されたエンティティを選択では、次のように各値を入力します。

* 信頼されたエンティティタイプ：AWSアカウントを選択
* AWSアカウント：「別のAWSアカウント」を選択し、アカウントIDに`162001151631`と入力します。
* \*\*外部 ID を要求する (サードパーティがこのロールを引き受ける場合のベストプラクティス)\*\*にチェック
* 外部IDには`ランダムな英数字（記号を除く24桁以上推奨）`を入力します。
* MFAが必要のチェックは外してください。

入力完了後、**次へ**をクリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710835053479-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=00a62ce616d1f8db0a1946badc8d1f41" alt="ロール作成画面" width="2984" height="1608" data-path="images/integrations/dc2mjsw9oy/1710835053479-image.png" />

3. 許可を追加画面が表示されますので、前項で作成したポリシー選択し画面を下にスクロール後、\[**次へ**]をクリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710835121503-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=3cb36a15b59dee2c38bffc3547410df4" alt="許可を追加画面" width="3198" height="1776" data-path="images/integrations/dc2mjsw9oy/1710835121503-image.png" />

4. ロールの名前（任意）を設定し、下にスクロール後、「ロールを作成」ボタンをクリックします。これでロールの作成が完了しました。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710835217427-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=1ae23f9b7659480139c87189d13e4499" alt="ロール名入力画面" width="3270" height="1770" data-path="images/integrations/dc2mjsw9oy/1710835217427-image.png" />

### Role ARNの確認方法

ロール画面で作成したロールを検索して表示、クリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710835390111-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=6b437d629b46a9153b03349a84c22cfc" alt="ロール一覧画面" width="3080" height="526" data-path="images/integrations/dc2mjsw9oy/1710835390111-image.png" />

**Role ARN**が表示されるので、コピーして保存しておきます。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1710835338354-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=5c30778ecbaef22edab598818483d2ea" alt="Role ARN表示画面" width="3052" height="720" data-path="images/integrations/dc2mjsw9oy/1710835338354-image.png" />

## インテグレーションのセットアップ

1. マネーフォワード Adminaのインテグレーション画面にて、**AWS IAM**で検索します。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1754989747725-screenshot.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=656073e199b43c76dc78558850102a0e" alt="Admina インテグレーション検索画面" width="650" height="426" data-path="images/integrations/dc2mjsw9oy/1754989747725-screenshot.png" />

2. 前の手順で取得した**Role ARN**および、ロール作成時に設定した**外部ID**を入力します。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1754989840214-screenshot.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=041efd2f7d9b18ef2dc8e3ddbed5f586" alt="Role ARN入力画面" width="656" height="592" data-path="images/integrations/dc2mjsw9oy/1754989840214-screenshot.png" />

3. パーミッションを選択します。

連携時にロールを取得しない場合は、［Read And Write（ロールを除く）］を選択します。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1754989918912-screenshot.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=9958f0f3636a1a0f240179bc2ee90ae3" alt="パーミッション選択画面" width="610" height="258" data-path="images/integrations/dc2mjsw9oy/1754989918912-screenshot.png" />

4. 入力内容を確認して、［連携する］をクリックします。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1754990118378-screenshot.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=6eacada90cc928517b1b175ecbc8a7f6" alt="連携確認画面" width="172" height="82" data-path="images/integrations/dc2mjsw9oy/1754990118378-screenshot.png" />

5. AWSとの連携に成功すると、アカウント一覧に登録済みのユーザー情報が表示されます。

正常に完了しない場合は、インテグレーション画面のステータスタブから**編集**し、再度連携をお試しください。

解決しない場合はチャットにてお問い合わせください。

AWSの連携概要については[連携ページ](http://admina.moneyforward.com/jp/integrations/amazon-web-service-aws)をご覧ください。

### 補足：メールアドレスの取得

AWSはデフォルトではメールアドレスを取得しないサービスのため、ユーザータイプは「不明」もしくは「システム」で取得します。

メールアドレスの取得するためには、以下のいずれかの方法をご利用ください。

1. [アカウントマージ機能](/it-management/saas-management/d97dy5z2l7-merge)の利用

ユーザータイプの付与が可能となり、より正確な退職者管理が可能となります。

2. タグを利用し、IAMユーザーに直接メールアドレスを付与する。

タグキーに`email`、タグ値にメールアドレスを付与することで、マネーフォワード Adminaがメールアドレスを取得します。

<img src="https://mintcdn.com/moneyforwardi/tJkXXxBZH7Ty4mGf/images/integrations/dc2mjsw9oy/1667987881744-image.png?fit=max&auto=format&n=tJkXXxBZH7Ty4mGf&q=85&s=17b8a4b21af6fbc8ebcbeda8cb6dbed0" alt="IAMタグ設定画面" width="2754" height="610" data-path="images/integrations/dc2mjsw9oy/1667987881744-image.png" />
