@pyriter/piezopy-iam-role
v1.1.6
Published
PIEZOPY IAM ROLE
Readme
Piezopy IAM Role
Description
A reusable AWS CDK construct that creates a standardized IAM role for dashboard applications. This construct provides a pre-configured IAM role with read-only access to AWS billing information, designed to be used across multiple CDK stacks or projects.
Features
- Standardized IAM Role: Creates a consistent IAM role with predefined permissions
- Billing Read Access: Automatically attaches
AWSBillingReadOnlyAccessmanaged policy - Conditional Creation: Optional role creation based on configuration
- CDK Integration: Built as a native CDK construct for seamless integration
- TypeScript Support: Full TypeScript definitions and source code
- Comprehensive Testing: Full test coverage with Jest
Install
npm install @pyriter/piezopy-iam-roleOne Time Setup
This construct requires AWS CDK to be set up in your project. Ensure you have:
- AWS CDK CLI installed globally
- AWS credentials configured
- CDK project initialized
Usage
Basic Usage
import { Stack, App } from 'aws-cdk-lib';
import { PiezopyDashboardIamRole } from '@pyriter/piezopy-iam-role';
const app = new App();
const stack = new Stack(app, 'MyStack');
// Create the dashboard IAM role
const dashboardRole = new PiezopyDashboardIamRole(stack, 'DashboardRole');
// The role is now available as dashboardRole.roleConditional Role Creation for multi-region deployment within same aws account
import { PiezopyDashboardIamRole } from '@pyriter/piezopy-iam-role';
const dashboardRole = new PiezopyDashboardIamRole(stack, 'DashboardRole', {
shouldCreate: false
});
API Reference
PiezopyDashboardIamRoleProps
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| shouldCreate | boolean | true | Whether to create the IAM role |
PiezopyDashboardIamRole
Properties
| Property | Type | Description |
|----------|------|-------------|
| role | iam.Role \| null | The created IAM role or null if not created |
Constructor
constructor(scope: Construct, id: string, props?: PiezopyDashboardIamRoleProps)IAM Role Details
The created IAM role has the following characteristics:
- Role Name:
PIEZOPY_DASHBOARD_DO_NOT_DELETE - Trust Policy: Allows the AWS account
861276101356to assume this role - Managed Policies:
AWSBillingReadOnlyAccess(read-only access to billing) - Removal Policy:
DESTROY(deleted when stack is destroyed)
Development
Prerequisites
- Node.js 18+
- TypeScript 5.0+
- AWS CDK 2.0+
Build
npm run buildTest
npm testWatch Mode
npm run watchContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the GPL License.
Support
- Issues: GitHub Issues
- Documentation: Package on npm
- Author: Phong Vuong
