Skip to content

Commit

Permalink
Merge pull request #15 from taahamahdi/support-more-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsoltz authored Jun 25, 2024
2 parents 11c1efd + da5b07b commit 85038ad
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This repository contains a list of almost all (WIP) AWS services and resources w

> :warning: **Work in progress**: This is a work in progress. Not all services and resources are included yet. Please open an issue or pull request if you find any errors or omissions.
The data is defined in the file [data.py](aws_arn/data.py) as Python dictionary.
The data is defined in the file [data.py](aws_arn/data.py) as Python dictionary.

For each service:

Expand Down Expand Up @@ -51,7 +51,7 @@ pip3 install aws-arn
import aws_arn

# Generate ARN using service and resource name
print(aws_arn.generate_arn('i-1234568901', 'ec2', 'instance', 'us-east-1', '012345789012', 'aws'))
print(aws_arn.generate_arn('i-1234568901', 'ec2', 'instance', 'us-east-1', '012345789012', 'aws'))
arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901

# Generate ARN using Terraform resource name
Expand All @@ -68,7 +68,7 @@ arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901
```

## Parse ARN:

```python
import aws_arn

Expand Down Expand Up @@ -173,13 +173,15 @@ arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901
| cloud9 | environment | `arn:{partition}:cloud9:{region}:{account}:environment:{resource_id}` | EnvironmentId | `[a-zA-Z0-9-]+` | | AWS::Cloud9::EnvironmentEC2 | aws_cloud9_environment_ec2 |
| cloudformation | change_set | `arn:{partition}:cloudformation:{region}:{account}:changeSet/{resource_id}` | ChangeSetId | `([a-zA-Z0-9-]+)` | | AWS::CloudFormation::ChangeSet | aws_cloudformation_change_set |
| cloudformation | stack | `arn:{partition}:cloudformation:{region}:{account}:stack/{resource_id}/{stack_id}` | StackName | `([a-zA-Z][-a-zA-Z0-9]*)` | AwsCloudFormationStack | AWS::CloudFormation::Stack | aws_cloudformation_stack |
| cloudformation | stack_set | `arn:{partition}:cloudformation:{region}:{account}:stackset/{resource_id}/{stack_id}` | StackSetName | `([a-zA-Z][-a-zA-Z0-9]*)` | | AWS::CloudFormation::StackSet | aws_cloudformation_stack_set |
| cloudfront | distribution | `arn:{partition}:cloudfront::{account}:distribution/{resource_id}` | DistributionId | `[A-Z0-9]+` | AwsCloudFrontDistribution | AWS::CloudFront::Distribution | aws_cloudfront_distribution |
| cloudfront | field_level_encryption_config | `arn:{partition}:cloudfront::{account}:field-level-encryption-config/{resource_id}` | FieldLevelEncryptionConfigId | `[A-Z0-9]+` | | AWS::CloudFront::FieldLevelEncryptionConfig | aws_cloudfront_field_level_encryption_config |
| cloudfront | field_level_encryption_profile | `arn:{partition}:cloudfront::{account}:field-level-encryption-profile/{resource_id}` | FieldLevelEncryptionProfileId | `[A-Z0-9]+` | | AWS::CloudFront::FieldLevelEncryptionProfile | aws_cloudfront_field_level_encryption_profile |
| cloudfront | realtime_log_config | `arn:{partition}:cloudfront::{account}:realtime-log-config/{resource_id}` | RealtimeLogConfigId | `[A-Z0-9]+` | | AWS::CloudFront::RealtimeLogConfig | aws_cloudfront_realtime_log_config |
| cloudhsmv2 | cluster | `arn:{partition}:cloudhsmv2:{region}:{account}:cluster/{resource_id}` | ClusterId | `[a-zA-Z0-9-]+` | | AWS::CloudHSMV2::Cluster | aws_cloudhsmv2_cluster |
| cloudhsmv2 | backup | `arn:{partition}:cloudhsmv2:{region}:{account}:backup/{resource_id}` | BackupId | `[a-zA-Z0-9-]+` | | AWS::CloudHSMV2::Backup | aws_cloudhsmv2_backup |
| cloudhsmv2 | hsm | `arn:{partition}:cloudhsmv2:{region}:{account}:cluster/{resource_id}/hsm/{hsm_id}` | HsmId | `[a-zA-Z0-9-]+` | | AWS::CloudHSMV2::Hsm | aws_cloudhsmv2_hsm |
| cloudtrail | event_data_store | `arn:{partition}:cloudtrail:{region}:{account}:eventdatastore/{resource_id}` | EventDataStoreName | `[a-zA-Z0-9-_\.]+` | | AWS::CloudTrail::EventDataStore | aws_cloudtrail_event_data_store |
| cloudtrail | trail | `arn:{partition}:cloudtrail:{region}:{account}:trail/{resource_id}` | TrailName | `[a-zA-Z0-9-_\.]+` | AwsCloudTrailTrail | AWS::CloudTrail::Trail | aws_cloudtrail |
| cloudwatch | alarm | `arn:{partition}:cloudwatch:{region}:{account}:alarm:{resource_id}` | AlarmName | `^[a-zA-Z0-9\-_]{1,255}$` | AwsCloudWatchAlarm | AWS::CloudWatch::Alarm | aws_cloudwatch_metric_alarm |
| cloudwatch | dashboard | `arn:{partition}:cloudwatch::{account}:dashboard/{resource_id}` | DashboardName | `^[a-zA-Z0-9-_ ]{3,255}$` | | AWS::CloudWatch::Dashboard | aws_cloudwatch_dashboard |
Expand Down Expand Up @@ -238,6 +240,7 @@ arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901
| ec2 | elastic_inference_accelerator | `arn:{partition}:elastic-inference:{region}:{account}:accelerator/{resource_id}` | AcceleratorId | `^eia-[0-9a-f]{17}$` | AwsElasticInferenceAccelerator | AWS::ElasticInference::Accelerator | aws_eia_accelerator |
| ec2 | eip_allocation | `arn:{partition}:ec2:{region}:{account}:eip-allocation/{resource_id}` | AllocationId | `^eipalloc-[0-9a-fA-F]{8,17}$` | AwsEc2Eip | AWS::EC2::EIP | aws_eip |
| ec2 | eip | `arn:{partition}:ec2:{region}:{account}:elastic-ip/{resource_id}` | AllocationId | `^eipalloc-[0-9a-fA-F]{8,17}$` | AwsEc2Eip | AWS::EC2::EIP | aws_eip |
| ec2 | fleet | `arn:{partition}:ec2:{region}:{account}:fleet/{resource_id}` | FleetId | `^fleet-[0-9a-f]{17}$` | | AWS::EC2::EC2Fleet | aws_ec2_fleet |
| ec2 | flow_log | `arn:{partition}:ec2:{region}:{account}:flow-log/{resource_id}` | FlowLogId | `^fl-[0-9a-f]{17}$` | | AWS::EC2::FlowLog | aws_flow_log |
| ec2 | image | `arn:{partition}:ec2:{region}:{account}:image/{resource_id}` | ImageId | `^ami-[a-f0-9]{8}$|^ami-[a-f0-9]{17}$` | | AWS::EC2::Image | aws_ami |
| ec2 | instance | `arn:{partition}:ec2:{region}:{account}:instance/{resource_id}` | InstanceId | `^i-[0-9a-f]{8,17}$` | AwsEc2Instance | AWS::EC2::Instance | aws_instance |
Expand Down Expand Up @@ -284,9 +287,10 @@ arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901
| elasticache | cache_cluster | `arn:{partition}:elasticache:{region}:{account}:cluster:{resource_id}` | CacheClusterId | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::CacheCluster | aws_elasticache_cluster |
| elasticache | cache_parameter_group | `arn:{partition}:elasticache:{region}:{account}:parameter-group:{resource_id}` | CacheParameterGroupName | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::CacheParameterGroup | aws_elasticache_parameter_group |
| elasticache | cache_security_group | `arn:{partition}:elasticache:{region}:{account}:security-group:{resource_id}` | CacheSecurityGroupName | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::SecurityGroup | aws_elasticache_security_group |
| elasticache | cache_subnet_group | `arn:{partition}:elasticache:{region}:{account}:subnet-group:{resource_id}` | CacheSubnetGroupName | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::SubnetGroup | aws_elasticache_subnet_group |
| elasticache | cache_subnet_group | `arn:{partition}:elasticache:{region}:{account}:subnetgroup:{resource_id}` | CacheSubnetGroupName | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::SubnetGroup | aws_elasticache_subnet_group |
| elasticache | global_replication_group | `arn:{partition}:elasticache:{region}:{account}:global-replication-group:{resource_id}` | GlobalReplicationGroupId | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::GlobalReplicationGroup | aws_elasticache_global_replication_group |
| elasticache | replication_group | `arn:{partition}:elasticache:{region}:{account}:cluster:{resource_id}` | ReplicationGroupId | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::ReplicationGroup | aws_elasticache_replication_group |
| elasticache | serverless_cache | `arn:{partition}:elasticache:{region}:{account}:serverlesscache:{resource_id}` | ServerlessCachename | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::ServerlessCache | aws_elasticache_serverless_cache |
| elasticache | user_group | `arn:{partition}:elasticache:{region}:{account}:user-group:{resource_id}` | UserGroupId | `([a-zA-Z0-9-]+)` | | AWS::ElastiCache::UserGroup | aws_elasticache_user_group |
| elasticbeanstalk | application | `arn:{partition}:elasticbeanstalk:{region}:{account}:application/{resource_id}` | ApplicationName | `([a-zA-Z0-9-_.]+)` | | AWS::ElasticBeanstalk::Application | aws_elastic_beanstalk_application |
| elasticbeanstalk | application_version | `arn:{partition}:elasticbeanstalk:{region}:{account}:applicationversion/{resource_id}` | ApplicationVersionName | `([a-zA-Z0-9-_.]+)` | | AWS::ElasticBeanstalk::ApplicationVersion | aws_elastic_beanstalk_application_version |
Expand Down Expand Up @@ -526,6 +530,10 @@ arn:aws:ec2:us-east-1:012345789012:instance/i-1234568901
| sagemaker | endpoint_config | `arn:{partition}:sagemaker:{region}:{account}:endpoint-config/{resource_id}` | EndpointConfigName | `^[a-zA-Z0-9](-*[a-zA-Z0-9])*$` | | AWS::SageMaker::EndpointConfig | aws_sagemaker_endpoint_configuration |
| sagemaker | endpoint | `arn:{partition}:sagemaker:{region}:{account}:endpoint/{resource_id}` | EndpointName | `^[a-zA-Z0-9](-*[a-zA-Z0-9])*$` | | AWS::SageMaker::Endpoint | aws_sagemaker_endpoint |
| sagemaker | feature_group | `arn:{partition}:sagemaker:{region}:{account}:feature-group/{resource_id}` | FeatureGroupName | `^[a-zA-Z0-9]([a-zA-Z0-9_-]{0,62}[a-zA-Z0-9])?$` | | AWS::SageMaker::FeatureGroup | aws_sagemaker_feature_group |
| schemas | discoverer | `arn:{partition}:schemas:{region}:{account}:discoverer/{resource_id}` | DiscovererId | `[0-9a-zA-Z_]+` | | AWS::EventSchemas::Discoverer | aws_schemas_discoverer |
| schemas | registry | `arn:{partition}:schemas:{region}:{account}:registry/{resource_id}` | RegistryName | `[0-9a-zA-Z_]+` | | AWS::EventSchemas::Registry | aws_schemas_registry |
| schemas | registry_policy | `arn:{partition}:schemas:{region}:{account}:registrypolicy/{resource_id}` | RegistryName | `[0-9a-zA-Z_]+` | | AWS::EventSchemas::RegistryPolicy | aws_schemas_registry |
| schemas | schema | `arn:{partition}:schemas:{region}:{account}:schema/{resource_id}` | SchemaName | `[0-9a-zA-Z_]+` | | AWS::EventSchemas::Schema | aws_schemas_schema |
| sdb | domain | `arn:{partition}:sdb:{region}:{account}:domain/{resource_id}` | DomainName | `^[a-zA-Z0-9_.-]{3,255}$` | | AWS::SDB::Domain | aws_sdb_domain |
| secretsmanager | secret | `arn:{partition}:secretsmanager:{region}:{account}:secret:{resource_id}` | SecretId | `^[a-zA-Z0-9/_+=.@-]{1,64}$` | AwsSecretsManagerSecret | AWS::SecretsManager::Secret | aws_secretsmanager_secret |
| securityhub | hub | `arn:{partition}:securityhub:{region}:{account}:hub/default` | none | `` | | AWS::SecurityHub::Hub | aws_securityhub_account |
Expand Down
68 changes: 67 additions & 1 deletion aws_arn/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@
"cloudformation": "AWS::CloudFormation::Stack",
"terraform": "aws_cloudformation_stack",
},
"stack_set": {
"arn_format": "arn:{partition}:cloudformation:{region}:{account}:stackset/{resource_id}/{stack_id}",
"id_name": "StackSetName",
"id_regexp": "([a-zA-Z][-a-zA-Z0-9]*)",
"asff_name": "",
"cloudformation": "AWS::CloudFormation::StackSet",
"terraform": "aws_cloudformation_stack_set",
},
},
"cloudfront": {
"distribution": {
Expand Down Expand Up @@ -492,6 +500,14 @@
},
},
"cloudtrail": {
"event_data_store": {
"arn_format": "arn:{partition}:cloudtrail:{region}:{account}:eventdatastore/{resource_id}",
"id_name": "EventDataStoreName",
"id_regexp": "[a-zA-Z0-9-_\\.]+",
"asff_name": "",
"cloudformation": "AWS::CloudTrail::EventDataStore",
"terraform": "aws_cloudtrail_event_data_store",
},
"trail": {
"arn_format": "arn:{partition}:cloudtrail:{region}:{account}:trail/{resource_id}",
"id_name": "TrailName",
Expand Down Expand Up @@ -998,6 +1014,14 @@
"cloudformation": "AWS::EC2::EIP",
"terraform": "aws_eip",
},
"fleet": {
"arn_format": "arn:{partition}:ec2:{region}:{account}:fleet/{resource_id}",
"id_name": "FleetId",
"id_regexp": "^fleet-[0-9a-f]{17}$",
"asff_name": "",
"cloudformation": "AWS::EC2::EC2Fleet",
"terraform": "aws_ec2_fleet",
},
"flow_log": {
"arn_format": "arn:{partition}:ec2:{region}:{account}:flow-log/{resource_id}",
"id_name": "FlowLogId",
Expand Down Expand Up @@ -1383,7 +1407,7 @@
"terraform": "aws_elasticache_security_group",
},
"cache_subnet_group": {
"arn_format": "arn:{partition}:elasticache:{region}:{account}:subnet-group:{resource_id}",
"arn_format": "arn:{partition}:elasticache:{region}:{account}:subnetgroup:{resource_id}",
"id_name": "CacheSubnetGroupName",
"id_regexp": "([a-zA-Z0-9-]+)",
"asff_name": "",
Expand All @@ -1406,6 +1430,14 @@
"cloudformation": "AWS::ElastiCache::ReplicationGroup",
"terraform": "aws_elasticache_replication_group",
},
"serverless_cache": {
"arn_format": "arn:{partition}:elasticache:{region}:{account}:serverlesscache:{resource_id}",
"id_name": "ServerlessCachename",
"id_regexp": "([a-zA-Z0-9-]+)",
"asff_name": "",
"cloudformation": "AWS::ElastiCache::ServerlessCache",
"terraform": "aws_elasticache_serverless_cache",
},
"user_group": {
"arn_format": "arn:{partition}:elasticache:{region}:{account}:user-group:{resource_id}",
"id_name": "UserGroupId",
Expand Down Expand Up @@ -3471,6 +3503,40 @@
"terraform": "aws_sagemaker_feature_group",
},
},
"schemas": {
"discoverer": {
"arn_format": "arn:{partition}:schemas:{region}:{account}:discoverer/{resource_id}",
"id_name": "DiscovererId",
"id_regexp": "[0-9a-zA-Z_]+",
"asff_name": "",
"cloudformation": "AWS::EventSchemas::Discoverer",
"terraform": "aws_schemas_discoverer",
},
"registry": {
"arn_format": "arn:{partition}:schemas:{region}:{account}:registry/{resource_id}",
"id_name": "RegistryName",
"id_regexp": "[0-9a-zA-Z_]+",
"asff_name": "",
"cloudformation": "AWS::EventSchemas::Registry",
"terraform": "aws_schemas_registry",
},
"registry_policy": {
"arn_format": "arn:{partition}:schemas:{region}:{account}:registrypolicy/{resource_id}",
"id_name": "RegistryName",
"id_regexp": "[0-9a-zA-Z_]+",
"asff_name": "",
"cloudformation": "AWS::EventSchemas::RegistryPolicy",
"terraform": "aws_schemas_registry",
},
"schema": {
"arn_format": "arn:{partition}:schemas:{region}:{account}:schema/{resource_id}",
"id_name": "SchemaName",
"id_regexp": "[0-9a-zA-Z_]+",
"asff_name": "",
"cloudformation": "AWS::EventSchemas::Schema",
"terraform": "aws_schemas_schema",
},
},
"sdb": {
"domain": {
"arn_format": "arn:{partition}:sdb:{region}:{account}:domain/{resource_id}",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="aws-arn",
version="0.0.19",
version="0.0.20",
description="A library to work with AWS ARNs",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 85038ad

Please sign in to comment.