nonebot-plugin-awsmgmt 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ def hello() -> str:
2
+ return "Hello from nonebot-plugin-awsmgmt!"
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.3
2
+ Name: nonebot-plugin-awsmgmt
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author-email: Maximilian Wu <me@maxng.cc>
6
+ Requires-Python: >=3.8
7
+ Requires-Dist: aioboto3>=15.0.0
8
+ Requires-Dist: nonebot2[fastapi]>=2.4.2
9
+ Description-Content-Type: text/markdown
10
+
11
+ # nonebot_plugin_awsmgmt
12
+
13
+ A NoneBot2 plugin for AWS management.
14
+
15
+ ## 使用方法
16
+
17
+ 1. **安装插件**
18
+
19
+ ```bash
20
+ pip install nonebot-plugin-awsmgmt
21
+ ```
22
+
23
+ 2. **在 NoneBot2 项目中加载插件**
24
+
25
+ 在 `bot.py` 或 `pyproject.toml` 中添加 `nonebot_plugin_awsmgmt` 到插件列表。
26
+
27
+ 例如,在 `pyproject.toml` 中:
28
+
29
+ ```toml
30
+ [tool.nonebot]
31
+ plugins = ["nonebot_plugin_awsmgmt"]
32
+ ```
33
+
34
+ 3. **配置 AWS 凭证**
35
+
36
+ 在 NoneBot2 项目的 `.env` 文件中配置 AWS 访问密钥和秘密访问密钥:
37
+
38
+ ```
39
+ AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
40
+ AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
41
+ AWS_REGION_NAME=your-aws-region # 例如:us-east-1
42
+ ```
43
+
44
+ ## AWS 侧配置
45
+
46
+ 为了使插件能够管理您的 AWS 资源,您需要在 AWS IAM 中创建一个具有适当权限的用户。
47
+
48
+ ### 1. 创建 IAM Policy
49
+
50
+ 创建一个新的 IAM Policy,并粘贴以下 JSON 内容。您可以根据需要修改此策略以限制权限。
51
+
52
+ **Policy JSON (`aws-policy.json`):**
53
+
54
+ ```json
55
+ {
56
+ "Version": "2012-10-17",
57
+ "Statement": [
58
+ {
59
+ "Effect": "Allow",
60
+ "Action": [
61
+ "ec2:DescribeInstances",
62
+ "ec2:RebootInstances"
63
+ ],
64
+ "Resource": "*"
65
+ },
66
+ {
67
+ "Effect": "Allow",
68
+ "Action": [
69
+ "ec2:StartInstances",
70
+ "ec2:StopInstances"
71
+ ],
72
+ "Resource": "arn:aws:ec2:*:*:instance/*",
73
+ "Condition": {
74
+ "StringEquals": {
75
+ "ec2:ResourceTag/ManagedBy": "nonebot-plugin-awsmgmt"
76
+ }
77
+ }
78
+ },
79
+ {
80
+ "Effect": "Allow",
81
+ "Action": [
82
+ "lightsail:GetInstances",
83
+ "lightsail:GetInstance",
84
+ "lightsail:StartInstance",
85
+ "lightsail:StopInstance"
86
+ ],
87
+ "Resource": "*"
88
+ },
89
+ {
90
+ "Effect": "Allow",
91
+ "Action": [
92
+ "ce:GetCostAndUsage"
93
+ ],
94
+ "Resource": "*"
95
+ }
96
+ ]
97
+ }
98
+ ```
99
+
100
+ **步骤:**
101
+
102
+ 1. 登录 AWS 管理控制台。
103
+ 2. 导航到 IAM 服务。
104
+ 3. 在左侧导航栏中选择 **Policies**。
105
+ 4. 点击 **Create policy**。
106
+ 5. 选择 **JSON** 选项卡,并粘贴上述 Policy JSON 内容。
107
+ 6. 点击 **Next: Tags**,然后点击 **Next: Review**。
108
+ 7. 为策略命名(例如:`NoneBotAWSPolicy`),并添加描述。
109
+ 8. 点击 **Create policy**。
110
+
111
+ ### 2. 创建 IAM 用户并附加策略
112
+
113
+ 创建一个新的 IAM 用户,并为其提供编程访问权限,然后附加您刚刚创建的策略。
114
+
115
+ **步骤:**
116
+
117
+ 1. 在 IAM 服务中,选择左侧导航栏中的 **Users**。
118
+ 2. 点击 **Add user**。
119
+ 3. 输入用户名(例如:`nonebot-aws-user`)。
120
+ 4. 在 **Select AWS access type** 部分,勾选 **Programmatic access**。
121
+ 5. 点击 **Next: Permissions**。
122
+ 6. 选择 **Attach existing policies directly**。
123
+ 7. 搜索并选择您刚刚创建的策略(例如:`NoneBotAWSPolicy`)。
124
+ 8. 点击 **Next: Tags**,然后点击 **Next: Review**。
125
+ 9. 点击 **Create user**。
126
+ 10. **重要:** 记录下生成的 **Access key ID** 和 **Secret access key**。这些将用于配置 NoneBot2 插件。这些凭证只显示一次,请务必妥善保管。
@@ -0,0 +1,4 @@
1
+ nonebot_plugin_awsmgmt/__init__.py,sha256=3-7xXlyyH7iTXdZ36lyytnJrIKWLXvUbj_45Hnuk6Bg,68
2
+ nonebot_plugin_awsmgmt-0.1.0.dist-info/METADATA,sha256=TPx99HgE1bSoNopTx5aUI12DELDpn4j9QHEUtHWREkw,3627
3
+ nonebot_plugin_awsmgmt-0.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
4
+ nonebot_plugin_awsmgmt-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.26.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any