simple-gh-aws-creds 0.1.1__tar.gz

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,15 @@
1
+ .. _about_author:
2
+
3
+ About the Author
4
+ ------------------------------------------------------------------------------
5
+ ::
6
+
7
+ (\ (\
8
+ ( -.-)o
9
+ o_(")(")
10
+
11
+ **Sanhe Hu** is a seasoned software engineer with a deep passion for Python development since 2010. As an author and maintainer of `150+ open-source Python projects <https://pypi.org/user/machugwu/>`_, with over `15 million monthly downloads <https://github.com/MacHu-GWU>`_, I bring a wealth of experience to the table. As a Senior Solution Architect and Subject Matter Expert in AI, Data, Amazon Web Services, Cloud Engineering, DevOps, I thrive on helping clients with platform design, enterprise architecture, and strategic roadmaps.
12
+
13
+ Talk is cheap, show me the code:
14
+
15
+ - My Github: https://github.com/MacHu-GWU
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sanhe Hu <husanhe@email.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,471 @@
1
+ Metadata-Version: 2.3
2
+ Name: simple_gh_aws_creds
3
+ Version: 0.1.1
4
+ Summary: Simple Python library to quickly set up AWS credentials for GitHub Actions without complex OIDC configuration.
5
+ License: MIT
6
+ Author: Sanhe Hu
7
+ Author-email: husanhe@email.com
8
+ Maintainer: Sanhe Hu
9
+ Maintainer-email: husanhe@email.com
10
+ Requires-Python: >=3.9,<4.0
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Provides-Extra: auto
19
+ Provides-Extra: dev
20
+ Provides-Extra: doc
21
+ Provides-Extra: test
22
+ Requires-Dist: PyGithub (>=2.1.1,<3.0.0)
23
+ Requires-Dist: Sphinx (>=7.4.7,<8.0.0) ; extra == "doc"
24
+ Requires-Dist: boto3 (>=1.35.0,<2.0.0)
25
+ Requires-Dist: boto_session_manager (>=1.0.0,<2.0.0) ; extra == "test"
26
+ Requires-Dist: build (>=1.2.1,<2.0.0) ; extra == "dev"
27
+ Requires-Dist: docfly (==3.0.0) ; extra == "doc"
28
+ Requires-Dist: furo (==2024.8.6) ; extra == "doc"
29
+ Requires-Dist: home_secret (>=0.1.1,<1.0.0) ; extra == "test"
30
+ Requires-Dist: ipython (>=8.18.1,<8.19.0) ; extra == "doc"
31
+ Requires-Dist: moto (>=5.0.0,<6.0.0) ; extra == "test"
32
+ Requires-Dist: nbsphinx (>=0.8.12,<1.0.0) ; extra == "doc"
33
+ Requires-Dist: pygments (>=2.18.0,<3.0.0) ; extra == "doc"
34
+ Requires-Dist: pytest (>=8.2.2,<9.0.0) ; extra == "test"
35
+ Requires-Dist: pytest-cov (>=6.0.0,<7.0.0) ; extra == "test"
36
+ Requires-Dist: rich (>=13.8.1,<14.0.0) ; extra == "dev"
37
+ Requires-Dist: rstobj (==1.2.1) ; extra == "doc"
38
+ Requires-Dist: sphinx-copybutton (>=0.5.2,<1.0.0) ; extra == "doc"
39
+ Requires-Dist: sphinx-design (>=0.6.1,<1.0.0) ; extra == "doc"
40
+ Requires-Dist: sphinx-jinja (>=2.0.2,<3.0.0) ; extra == "doc"
41
+ Requires-Dist: twine (>=6.0.0,<7.0.0) ; extra == "dev"
42
+ Requires-Dist: wheel (>=0.45.0,<1.0.0) ; extra == "dev"
43
+ Project-URL: Changelog, https://github.com/MacHu-GWU/simple_gh_aws_creds-project/blob/main/release-history.rst
44
+ Project-URL: Documentation, https://simple-gh-aws-creds.readthedocs.io/en/latest/
45
+ Project-URL: Download, https://pypi.org/pypi/simple-gh-aws-creds#files
46
+ Project-URL: Homepage, https://github.com/MacHu-GWU/simple_gh_aws_creds-project
47
+ Project-URL: Issues, https://github.com/MacHu-GWU/simple_gh_aws_creds-project/issues
48
+ Project-URL: Repository, https://github.com/MacHu-GWU/simple_gh_aws_creds-project
49
+ Description-Content-Type: text/x-rst
50
+
51
+
52
+ .. image:: https://readthedocs.org/projects/simple-gh-aws-creds/badge/?version=latest
53
+ :target: https://simple-gh-aws-creds.readthedocs.io/en/latest/
54
+ :alt: Documentation Status
55
+
56
+ .. image:: https://github.com/MacHu-GWU/simple_gh_aws_creds-project/actions/workflows/main.yml/badge.svg
57
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project/actions?query=workflow:CI
58
+
59
+ .. image:: https://codecov.io/gh/MacHu-GWU/simple_gh_aws_creds-project/branch/main/graph/badge.svg
60
+ :target: https://codecov.io/gh/MacHu-GWU/simple_gh_aws_creds-project
61
+
62
+ .. image:: https://img.shields.io/pypi/v/simple-gh-aws-creds.svg
63
+ :target: https://pypi.python.org/pypi/simple-gh-aws-creds
64
+
65
+ .. image:: https://img.shields.io/pypi/l/simple-gh-aws-creds.svg
66
+ :target: https://pypi.python.org/pypi/simple-gh-aws-creds
67
+
68
+ .. image:: https://img.shields.io/pypi/pyversions/simple-gh-aws-creds.svg
69
+ :target: https://pypi.python.org/pypi/simple-gh-aws-creds
70
+
71
+ .. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
72
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project/blob/main/release-history.rst
73
+
74
+ .. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
75
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project
76
+
77
+ ------
78
+
79
+ .. image:: https://img.shields.io/badge/Link-API-blue.svg
80
+ :target: https://simple-gh-aws-creds.readthedocs.io/en/latest/py-modindex.html
81
+
82
+ .. image:: https://img.shields.io/badge/Link-Install-blue.svg
83
+ :target: `install`_
84
+
85
+ .. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
86
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project
87
+
88
+ .. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
89
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project/issues
90
+
91
+ .. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
92
+ :target: https://github.com/MacHu-GWU/simple_gh_aws_creds-project/issues
93
+
94
+ .. image:: https://img.shields.io/badge/Link-Download-blue.svg
95
+ :target: https://pypi.org/pypi/simple-gh-aws-creds#files
96
+
97
+
98
+ Welcome to ``simple_gh_aws_creds`` Documentation
99
+ ==============================================================================
100
+ .. image:: https://simple-gh-aws-creds.readthedocs.io/en/latest/_static/simple_gh_aws_creds-logo.png
101
+ :target: https://simple-gh-aws-creds.readthedocs.io/en/latest/
102
+
103
+ ``simple_gh_aws_creds`` is a Python library that automates the setup of AWS credentials for GitHub Actions workflows. It provides a simple, streamlined approach to grant your GitHub repositories the AWS permissions they need for CI/CD operations.
104
+
105
+
106
+ Overview
107
+ ------------------------------------------------------------------------------
108
+ Using GitHub Actions for CI/CD is incredibly popular in the developer community, and deploying applications to AWS is equally common. But how do you give GitHub Actions the necessary AWS permissions? This library provides a simple, automated solution.
109
+
110
+ The library automates the complete workflow:
111
+
112
+ 1. **Creates IAM User** - Dedicated user for your GitHub repository
113
+ 2. **Attaches IAM Policies** - Minimal required permissions (inline + managed policies)
114
+ 3. **Generates Access Keys** - AWS credentials for authentication
115
+ 4. **Configures GitHub Secrets** - Automatically uploads credentials to your repository
116
+
117
+ For cleanup, the process reverses: removes GitHub secrets, deletes access keys, detaches policies, and removes the IAM user.
118
+
119
+
120
+ When to Use This Library
121
+ ------------------------------------------------------------------------------
122
+ **✅ Ideal Use Cases:**
123
+
124
+ - **Small to Medium Projects** - Perfect for personal projects, prototypes, and small team applications
125
+ - **Rapid Development** - Need to quickly set up AWS access without complex configuration
126
+ - **Temporary Projects** - Projects with short lifecycles that need quick setup and teardown
127
+ - **Learning & Testing** - Educational projects or when experimenting with AWS services
128
+ - **Open Source Projects** - Simple automation for contributors without complex OIDC setup
129
+ - **Quick Prototyping** - When you need AWS access immediately for proof-of-concepts
130
+
131
+ **❌ When NOT to Use:**
132
+
133
+ - **Enterprise Production** - Large-scale production environments with strict security requirements
134
+ - **Long-lived Credentials** - If you need credentials that persist for months/years
135
+ - **Complex Permission Management** - When you need sophisticated IAM role hierarchies
136
+ - **Compliance Requirements** - Environments requiring audit trails, temporary credentials, or specific security standards
137
+ - **Multi-Account Strategies** - Complex AWS Organizations with cross-account access patterns
138
+
139
+ **🏆 Recommended Alternative for Production:**
140
+
141
+ For enterprise applications, **OIDC (OpenID Connect) with GitHub Actions** is the gold standard. It provides:
142
+
143
+ - Temporary, short-lived credentials
144
+ - No long-lived secrets to manage
145
+ - Better audit trails and security
146
+ - Fine-grained permission control
147
+
148
+ However, OIDC setup is more complex and requires deeper AWS knowledge. This library bridges the gap for scenarios where you need quick, automated setup with simpler requirements.
149
+
150
+
151
+ Security Considerations
152
+ ------------------------------------------------------------------------------
153
+ This library trades some security for simplicity and automation:
154
+
155
+ **Security Features:**
156
+ - Principle of least privilege (minimal required permissions)
157
+ - Secure credential storage in GitHub Secrets (encrypted at rest)
158
+ - Complete cleanup capabilities to prevent credential sprawl
159
+ - Automated resource tagging for tracking and management
160
+
161
+ **Security Trade-offs:**
162
+ - Uses long-lived IAM user credentials (less secure than OIDC temporary tokens)
163
+ - Stores credentials in GitHub Secrets (still secure, but not as robust as OIDC)
164
+ - Simpler setup means less granular control over permissions
165
+
166
+
167
+ Quick Start Example
168
+ ------------------------------------------------------------------------------
169
+ Here's a complete example showing how to set up AWS credentials for your GitHub repository:
170
+
171
+ .. code-block:: python
172
+
173
+ # -*- coding: utf-8 -*-
174
+
175
+ """
176
+ AWS Credentials Setup for GitHub Actions - Complete Example
177
+
178
+ This script demonstrates how to automatically set up AWS credentials for GitHub Actions
179
+ using the simple_gh_aws_creds library. It creates an IAM user with minimal permissions,
180
+ generates access keys, and configures GitHub repository secrets.
181
+
182
+ Prerequisites
183
+ ------------------------------------------------------------------------------
184
+ 1. AWS CLI configured with appropriate credentials (or use AWS profile)
185
+ 2. GitHub personal access token with 'repo' scope permissions
186
+ 3. Python dependencies installed:
187
+ - simple-gh-aws-creds
188
+ - boto-session-manager
189
+ - home-secret (for secure token management)
190
+
191
+ What this script does
192
+ ------------------------------------------------------------------------------
193
+ - Creates an IAM user specifically for GitHub Actions
194
+ - Attaches minimal IAM permissions (inline policy + optional managed policies)
195
+ - Generates AWS access keys and stores them locally
196
+ - Configures GitHub repository secrets for CI/CD workflows
197
+ - Provides cleanup functionality to remove all resources
198
+
199
+ Security considerations
200
+ ------------------------------------------------------------------------------
201
+ - Uses principle of least privilege (minimal required permissions)
202
+ - Stores credentials securely in GitHub Secrets (encrypted)
203
+ - Provides complete cleanup to avoid credential sprawl
204
+ - Access keys are long-lived (consider OIDC for production)
205
+
206
+ Usage
207
+ ------------------------------------------------------------------------------
208
+ 1. Customize the configuration parameters below
209
+ 2. Run setup_all() to create resources
210
+ 3. Run teardown_all() to clean up everything
211
+ 4. Switch between setup/teardown by commenting/uncommenting at the bottom
212
+ """
213
+
214
+ from pathlib import Path
215
+ from boto_session_manager import BotoSesManager
216
+ from home_secret.api import hs
217
+ from simple_gh_aws_creds.api import SetupGitHubRepo
218
+
219
+ # =============================================================================
220
+ # Configuration Parameters - Customize these for your project
221
+ # =============================================================================
222
+
223
+ # AWS region where IAM user will be created and used
224
+ # Choose the region closest to your infrastructure or where your main AWS resources are located
225
+ aws_region = "us-east-1"
226
+
227
+ # GitHub repository information
228
+ # Replace with your actual GitHub username/organization and repository name
229
+ github_user_name = "MacHu-GWU" # Your GitHub username or organization name
230
+ github_repo_name = "simple_gh_aws_creds-project" # Your repository name
231
+
232
+ # Create the SetupGitHubRepo instance with all configuration
233
+ setup = SetupGitHubRepo(
234
+ # AWS Session Configuration
235
+ # BotoSesManager handles AWS authentication - replace profile_name with your AWS profile
236
+ # Alternative: Use default credentials, environment variables, or IAM roles
237
+ boto_ses=BotoSesManager(
238
+ profile_name="bmt_app_dev_us_east_1", # Replace with your AWS CLI profile name
239
+ region_name=aws_region,
240
+ ).boto_ses,
241
+
242
+ # AWS Region (same as above for consistency)
243
+ aws_region=aws_region,
244
+
245
+ # IAM User Configuration
246
+ # This will be the name of the IAM user created for GitHub Actions
247
+ # Use a descriptive name that identifies its purpose and project
248
+ iam_user_name="gh-ci-simple_gh_aws_creds", # Format: gh-ci-{project-name}
249
+
250
+ # Resource Tags (for AWS cost tracking and resource management)
251
+ # These tags help you identify and manage resources in the AWS console
252
+ tags={
253
+ "tech:use_case": "for GitHub Action to list Account aliases", # Describe what this user does
254
+ "github_user_name": github_user_name, # Link back to GitHub owner
255
+ "github_repo_name": github_repo_name, # Link back to GitHub repo
256
+ "automation_script": f"https://github.com/{github_user_name}/{github_repo_name}/blob/main/docs/source/01-Examples/setup_dev_account.py",
257
+ },
258
+
259
+ # IAM Inline Policy Document
260
+ # Define the minimal permissions needed for your GitHub Actions
261
+ # This example allows listing account aliases - customize for your needs
262
+ policy_document={
263
+ "Version": "2012-10-17", # Current IAM policy version
264
+ "Statement": [
265
+ {
266
+ "Sid": "VisualEditor1", # Statement identifier
267
+ "Effect": "Allow", # Grant permission
268
+ "Action": [
269
+ "iam:ListAccountAliases", # Replace with actions your workflow needs
270
+ # Add more actions as needed:
271
+ # "s3:GetObject", "s3:PutObject", # For S3 operations
272
+ # "lambda:InvokeFunction", # For Lambda operations
273
+ # "ssm:GetParameter", # For Parameter Store
274
+ ],
275
+ "Resource": "*", # Scope to specific resources in production
276
+ },
277
+ ],
278
+ },
279
+
280
+ # AWS Managed Policies (optional)
281
+ # List of existing AWS managed policy ARNs to attach to the IAM user
282
+ # These provide pre-defined permission sets for common use cases
283
+ attached_policy_arn_list=[
284
+ "arn:aws:iam::aws:policy/IAMReadOnlyAccess", # Example: Read-only IAM access
285
+ # Common managed policies you might need:
286
+ # "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess",
287
+ # "arn:aws:iam::aws:policy/AWSLambdaExecute",
288
+ # "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess",
289
+ ],
290
+
291
+ # Local Storage for Access Keys
292
+ # File where AWS access keys will be stored locally for reuse
293
+ # This file should be added to .gitignore to avoid committing credentials
294
+ path_access_key_json=(
295
+ Path(__file__).absolute().parent.joinpath("dev_access_key.json")
296
+ ),
297
+
298
+ # GitHub Repository Details (repeated for clarity)
299
+ github_user_name=github_user_name,
300
+ github_repo_name=github_repo_name,
301
+
302
+ # GitHub Personal Access Token
303
+ # This example uses home_secret library for secure token storage
304
+ # Alternative methods:
305
+ # - Environment variable: os.environ["GITHUB_TOKEN"]
306
+ # - Direct string: "ghp_your_token_here" (NOT recommended for production)
307
+ # - External secret manager integration
308
+ github_token=hs.v("providers.github.accounts.sh.users.sh.secrets.dev.value"),
309
+
310
+ # GitHub Secrets Configuration
311
+ # These are the names that will be used for the GitHub repository secrets
312
+ # Your GitHub Actions workflows will use these exact names to access AWS credentials
313
+ github_secret_name_aws_default_region="DEV_ACC_AWS_REGION", # AWS region secret name
314
+ github_secret_name_aws_access_key_id="DEV_ACC_AWS_ACCESS_KEY_ID", # AWS access key ID secret name
315
+ github_secret_name_aws_secret_access_key="DEV_ACC_AWS_SECRET_ACCESS_KEY", # AWS secret key secret name
316
+ )
317
+
318
+ # =============================================================================
319
+ # Execution Functions - Choose setup or teardown
320
+ # =============================================================================
321
+
322
+ if __name__ == "__main__":
323
+
324
+ def setup_all():
325
+ """
326
+ Complete setup workflow - Creates all AWS and GitHub resources
327
+
328
+ This function runs the full setup process in the correct order:
329
+ 1. Creates IAM user in AWS
330
+ 2. Attaches IAM policies (inline + managed policies)
331
+ 3. Generates AWS access keys and stores them locally
332
+ 4. Configures GitHub repository secrets for CI/CD
333
+
334
+ Run this function when you want to set up AWS credentials for a new project
335
+ or when you need to recreate the credentials from scratch.
336
+
337
+ Prerequisites:
338
+ - AWS credentials configured (CLI profile, environment variables, or IAM role)
339
+ - GitHub personal access token with 'repo' scope
340
+ - Proper permissions to create IAM users and attach policies
341
+ """
342
+ print("🚀 Starting complete AWS credentials setup for GitHub Actions...")
343
+ print("=" * 70)
344
+
345
+ setup.s11_create_iam_user() # Step 1: Create IAM user
346
+ setup.s12_put_iam_policy() # Step 2: Attach policies
347
+ setup.s13_create_or_get_access_key() # Step 3: Generate access keys
348
+ setup.s14_setup_github_secrets() # Step 4: Configure GitHub secrets
349
+
350
+ print("=" * 70)
351
+ print("✅ Setup complete! Your GitHub Actions can now use AWS credentials.")
352
+ print(f"🔗 Check your GitHub secrets at: https://github.com/{github_user_name}/{github_repo_name}/settings/secrets/actions")
353
+ print("📝 Example GitHub Actions workflow:")
354
+ print("""
355
+ name: AWS Example
356
+ on: [push]
357
+ jobs:
358
+ aws-job:
359
+ runs-on: ubuntu-latest
360
+ steps:
361
+ - uses: actions/checkout@v4
362
+ - name: Configure AWS credentials
363
+ uses: aws-actions/configure-aws-credentials@v4
364
+ with:
365
+ aws-access-key-id: ${{ secrets.DEV_ACC_AWS_ACCESS_KEY_ID }}
366
+ aws-secret-access-key: ${{ secrets.DEV_ACC_AWS_SECRET_ACCESS_KEY }}
367
+ aws-region: ${{ secrets.DEV_ACC_AWS_REGION }}
368
+ - name: Test AWS access
369
+ run: aws iam list-account-aliases
370
+ """)
371
+
372
+ def teardown_all():
373
+ """
374
+ Complete cleanup workflow - Removes all AWS and GitHub resources
375
+
376
+ This function runs the full cleanup process in the correct order:
377
+ 1. Removes GitHub repository secrets
378
+ 2. Deletes AWS access keys
379
+ 3. Detaches and deletes IAM policies
380
+ 4. Deletes IAM user
381
+
382
+ Run this function when you want to:
383
+ - Clean up after testing
384
+ - Rotate credentials completely
385
+ - Decommission a project
386
+ - Remove unused credentials for security
387
+
388
+ ⚠️ WARNING: This will permanently delete all AWS credentials and GitHub secrets!
389
+ Make sure your GitHub Actions workflows don't depend on these credentials before running.
390
+ """
391
+ print("🗑️ Starting complete cleanup of AWS credentials and GitHub secrets...")
392
+ print("=" * 70)
393
+
394
+ setup.s21_delete_github_secrets() # Step 1: Remove GitHub secrets
395
+ setup.s22_delete_access_key() # Step 2: Delete AWS access keys
396
+ setup.s23_delete_iam_policy() # Step 3: Detach/delete policies
397
+ setup.s24_delete_iam_user() # Step 4: Delete IAM user
398
+
399
+ print("=" * 70)
400
+ print("✅ Cleanup complete! All AWS resources and GitHub secrets have been removed.")
401
+ print("🔒 Your AWS account is now clean of automation credentials.")
402
+
403
+ # =============================================================================
404
+ # Main Execution - Choose one option below
405
+ # =============================================================================
406
+
407
+ # Option 1: Set up everything (uncomment to run)
408
+ setup_all()
409
+
410
+ # Option 2: Clean up everything (uncomment to run, comment setup_all() above)
411
+ # teardown_all()
412
+
413
+ # Option 3: Run individual steps (for testing or partial operations)
414
+ # setup.s11_create_iam_user() # Create just the IAM user
415
+ # setup.s12_put_iam_policy() # Attach just the policies
416
+ # setup.s13_create_or_get_access_key() # Generate just the access keys
417
+ # setup.s14_setup_github_secrets() # Configure just the GitHub secrets
418
+
419
+ # Individual cleanup steps:
420
+ # setup.s21_delete_github_secrets() # Remove just GitHub secrets
421
+ # setup.s22_delete_access_key() # Delete just access keys
422
+ # setup.s23_delete_iam_policy() # Detach just policies
423
+ # setup.s24_delete_iam_user() # Delete just IAM user
424
+
425
+
426
+ The example above demonstrates:
427
+
428
+ - Complete configuration for a real project
429
+ - Minimal IAM permissions (``iam:ListAccountAliases``)
430
+ - Optional AWS managed policy attachment
431
+ - GitHub secrets configuration
432
+ - Both setup and teardown workflows
433
+
434
+ After running the setup, your GitHub Actions can use the credentials like this:
435
+
436
+ .. code-block:: yaml
437
+
438
+ name: AWS Example
439
+ on: [push]
440
+ jobs:
441
+ aws-job:
442
+ runs-on: ubuntu-latest
443
+ steps:
444
+ - uses: actions/checkout@v4
445
+ - name: Configure AWS credentials
446
+ uses: aws-actions/configure-aws-credentials@v4
447
+ with:
448
+ aws-access-key-id: ${{ secrets.DEV_ACC_AWS_ACCESS_KEY_ID }}
449
+ aws-secret-access-key: ${{ secrets.DEV_ACC_AWS_SECRET_ACCESS_KEY }}
450
+ aws-region: ${{ secrets.DEV_ACC_AWS_REGION }}
451
+ - name: Test AWS access
452
+ run: aws iam list-account-aliases
453
+
454
+
455
+ .. _install:
456
+
457
+ Install
458
+ ------------------------------------------------------------------------------
459
+
460
+ ``simple_gh_aws_creds`` is released on PyPI, so all you need is to:
461
+
462
+ .. code-block:: console
463
+
464
+ $ pip install simple-gh-aws-creds
465
+
466
+ To upgrade to latest version:
467
+
468
+ .. code-block:: console
469
+
470
+ $ pip install --upgrade simple-gh-aws-creds
471
+