Standard Library

This library reference describes the standard library that is distributed with InGraph.

Pseudo Parameters#

Pseudo parameters are parameters that are predefined by AWS CloudFormation.

Module#

ingraph.aws

Constants#

ACCOUNT_ID: str#

The AWS account ID of the account of the current stack.

AVAILABILITY_ZONES: List[str]#

The list of Availability Zones for the region of the current stack.

from ingraph.aws import AVAILABILITY_ZONES
from ingraph.aws.aws_ec2 import Subnet
class Example:
def __init__(self, vpc_id: str):
subnet = Subnet(
VpcId=vpc_id,
CidrBlock="10.0.0.0/24",
AvailabilityZone=AVAILABILITY_ZONES[0],
)

NOTIFICATION_ARNS: List[str]#

The list of notification Amazon Resource Names (ARNs) for the current stack.

from ingraph.aws import NOTIFICATION_ARNS
from ingraph.aws.aws_autoscaling import AutoScalingGroup
class Example:
def __init__(self, launch_config_name: str):
asg = AutoScalingGroup(
AvailabilityZones=["us-east-1a"],
LaunchConfigurationName=launch_config_name,
MinSize="0",
MaxSize="0",
NotificationConfigurations=[
AutoScalingGroup.NotificationConfiguration(
TopicARN=NOTIFICATION_ARNS[0],
NotificationTypes=[
"autoscaling:EC2_INSTANCE_LAUNCH",
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
],
)
],
)

PARTITION: str#

For standard AWS regions, the partition is aws. For other regions, the partition is aws-partitionname. For example, the partition in the China (Beijing and Ningxia) region is aws-cn and the partition in the AWS GovCloud (US-West) region is aws-us-gov.

REGION: str#

The AWS Region of the current stack.

from ingraph import aws
class Example:
region: str
def __init__(self) -> None:
...
self.region = aws.REGION

STACK_ID: str#

The ID of the current stack.

STACK_NAME: str#

The name of the current stack.

URL_SUFFIX: str#

The suffix for a domain. The suffix is typically amazonaws.com, but might differ by region. For example, the suffix for the China (Beijing) region is amazonaws.com.cn.

Intrinsic Functions#

Intrinsic functions are functions that are predefined by AWS CloudFormation.

Module#

ingraph.aws

Functions#

b64encode(target: str) -> str#

Returns the Base64 representation of the input string.

cidr(block: str, count: int, bits: int) -> List[str]#

Returns an array of CIDR address blocks.

from ingraph.aws import aws_ec2, cidr
class Example:
def __init__(self) -> None:
vpc = aws_ec2.VPC(CidrBlock="10.0.0.0/16")
vpcblock6 = aws_ec2.VPCCidrBlock(
AmazonProvidedIpv6CidrBlock=True,
VpcId=vpc.Ref,
)
subblock4 = cidr(block=vpc.CidrBlock, count=1, bits=8)[0]
subblock6 = cidr(block=vpc.Ipv6CidrBlocks[0], count=1, bits=64)[0]
subnet = aws_ec2.Subnet(
AssignIpv6AddressOnCreation=True,
CidrBlock=subblock4,
Ipv6CidrBlock=subblock6,
VpcId=vpc.Ref,
DependsOn=[vpcblock6],
)

Assets#

Module#

ingraph.aws

Functions#

Asset(name: str, package: Optional[ModuleType], compress: Optional[bool])#

Returns an artifact within a package.

from ingraph.aws import Asset, aws_iam, aws_lambda
class InlineExample:
def __init__(self) -> None:
role = aws_iam.Role(
AssumeRolePolicyDocument={
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Principal": {"Service": "lambda.amazonaws.com"},
"Action": "sts:AssumeRole",
},
},
ManagedPolicyArns=[
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
)
handler = Asset(name="handler.js")
function = aws_lambda.Function(
Code=aws_lambda.Function.Code(ZipFile=handler.text),
Handler="index.handle",
Role=role.Arn,
Runtime="nodejs12.x",
)
from ingraph.aws import Asset, aws_iam, aws_lambda
class ZipExample:
uri: str
url: str
def __init__(self) -> None:
role = aws_iam.Role(
AssumeRolePolicyDocument={
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Principal": {"Service": "lambda.amazonaws.com"},
"Action": "sts:AssumeRole",
},
},
ManagedPolicyArns=[
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
)
handler = Asset(name="handler.js", compress=True)
function = aws_lambda.Function(
Code=aws_lambda.Function.Code(
S3Bucket=handler.bucket,
S3Key=handler.key
),
Handler="index.handle",
Role=role.Arn,
Runtime="nodejs12.x",
)
self.uri = handler.uri
self.url = handler.url
Attributes#
url: str#

The S3 URL of the asset.

https://{BUCKET}.s3.amazonaws.com/{PREFIX}{HASH}

uri: str#

The S3 URI of the asset.

s3://{BUCKET}/{PREFIX}{HASH}

bucket: str#

The S3 bucket of all assets. It is automatically injected in the parameters section of the final YAML template.

AWSTemplateFormatVersion: "2010-09-09"
Parameters:
AssetsS3Bucket:
Type: String
key: str#

The concatenation of the S3 prefix (if any) with the deterministic hash of the asset. The S3 prefix is automatically injected in the parameters section of the final YAML template.

AWSTemplateFormatVersion: "2010-09-09"
Parameters:
AssetsS3Prefix:
Type: String
text: str#

The textual content of an asset. Note that if an asset is compressed, you cannot reference its textual content.

Native Resources#

Native resources are AWS resources that are predefined by AWS CloudFormation.

Amazon EMR#

Module#

ingraph.aws.aws_emr

Resources#

AWS Auto Scaling#

Module#

ingraph.aws.aws_autoscalingplans

Resources#

MediaLive#

Module#

ingraph.aws.aws_medialive

Resources#

Amazon DocumentDB#

Module#

ingraph.aws.aws_docdb

Resources#

CodeStarConnections#

Module#

ingraph.aws.aws_codestarconnections

Resources#

API Gateway V2#

Module#

ingraph.aws.aws_apigatewayv2

Resources#

AWS SFTP#

Module#

ingraph.aws.aws_transfer

Resources#

IoT#

Module#

ingraph.aws.aws_iot

Resources#

Amazon Kinesis#

Module#

ingraph.aws.aws_kinesis

Resources#

RAM#

Module#

ingraph.aws.aws_ram

Resources#

Amazon Kinesis Data Analytics V2#

Module#

ingraph.aws.aws_kinesisanalyticsv2

Resources#

ResourceGroups#

Module#

ingraph.aws.aws_resourcegroups

Resources#

DAX#

Module#

ingraph.aws.aws_dax

Resources#

Lambda#

Module#

ingraph.aws.aws_lambda

Resources#

ElastiCache#

Module#

ingraph.aws.aws_elasticache

Resources#

MediaConvert#

Module#

ingraph.aws.aws_mediaconvert

Resources#

WorkSpaces#

Module#

ingraph.aws.aws_workspaces

Resources#

CodePipeline#

Module#

ingraph.aws.aws_codepipeline

Resources#

ElasticLoadBalancingV2#

Module#

ingraph.aws.aws_elasticloadbalancingv2

Resources#

CloudWatch Logs#

Module#

ingraph.aws.aws_logs

Resources#

AWS Cloud9#

Module#

ingraph.aws.aws_cloud9

Resources#

CodeBuild#

Module#

ingraph.aws.aws_codebuild

Resources#

CloudFront#

Module#

ingraph.aws.aws_cloudfront

Resources#

Service Catalog#

Module#

ingraph.aws.aws_servicecatalog

Resources#

Amazon ECR#

Module#

ingraph.aws.aws_ecr

Resources#

Route 53#

Module#

ingraph.aws.aws_route53

Resources#

AppConfig#

Module#

ingraph.aws.aws_appconfig

Resources#

EKS#

Module#

ingraph.aws.aws_eks

Resources#

ManagedBlockchain#

Module#

ingraph.aws.aws_managedblockchain

Resources#

GroundStation#

Module#

ingraph.aws.aws_groundstation

Resources#

AmazonMQ#

Module#

ingraph.aws.aws_amazonmq

Resources#

Amazon SageMaker#

Module#

ingraph.aws.aws_sagemaker

Resources#

Chatbot#

Module#

ingraph.aws.aws_chatbot

Resources#

OpsWorks#

Module#

ingraph.aws.aws_opsworks

Resources#

SecurityHub#

Module#

ingraph.aws.aws_securityhub

Resources#

Route 53 Resolver#

Module#

ingraph.aws.aws_route53resolver

Resources#

IAM#

Module#

ingraph.aws.aws_iam

Resources#

Elastic Load Balancing#

Module#

ingraph.aws.aws_elasticloadbalancing

Resources#

API Gateway#

Module#

ingraph.aws.aws_apigateway

Resources#

GameLift#

Module#

ingraph.aws.aws_gamelift

Resources#

EventSchemas#

Module#

ingraph.aws.aws_eventschemas

Resources#

AppSync#

Module#

ingraph.aws.aws_appsync

Resources#

Amazon SimpleDB#

Module#

ingraph.aws.aws_sdb

Resources#

Step Functions#

Module#

ingraph.aws.aws_stepfunctions

Resources#

DLM#

Module#

ingraph.aws.aws_dlm

Resources#

Systems Manager#

Module#

ingraph.aws.aws_ssm

Resources#

IoT1Click#

Module#

ingraph.aws.aws_iot1click

Resources#

CloudFormation#

Module#

ingraph.aws.aws_cloudformation

Resources#

MediaStore#

Module#

ingraph.aws.aws_mediastore

Resources#

FSx#

Module#

ingraph.aws.aws_fsx

Resources#

FMS#

Module#

ingraph.aws.aws_fms

Resources#

AWS Data Pipeline#

Module#

ingraph.aws.aws_datapipeline

Resources#

Amazon EC2 Auto Scaling#

Module#

ingraph.aws.aws_autoscaling

Resources#

AWS Budgets#

Module#

ingraph.aws.aws_budgets

Resources#

AWS Backup#

Module#

ingraph.aws.aws_backup

Resources#

GuardDuty#

Module#

ingraph.aws.aws_guardduty

Resources#

Amazon SQS#

Module#

ingraph.aws.aws_sqs

Resources#

CodeStarNotifications#

Module#

ingraph.aws.aws_codestarnotifications

Resources#

Directory Service#

Module#

ingraph.aws.aws_directoryservice

Resources#

DynamoDB#

Module#

ingraph.aws.aws_dynamodb

Resources#

Amazon Kinesis Data Firehose#

Module#

ingraph.aws.aws_kinesisfirehose

Resources#

AWS IoT Things Graph#

Module#

ingraph.aws.aws_iotthingsgraph

Resources#

App Mesh#

Module#

ingraph.aws.aws_appmesh

Resources#

DMS#

Module#

ingraph.aws.aws_dms

Resources#

CodeGuruProfiler#

Module#

ingraph.aws.aws_codeguruprofiler

Resources#

RDS#

Module#

ingraph.aws.aws_rds

Resources#

CloudTrail#

Module#

ingraph.aws.aws_cloudtrail

Resources#

QLDB#

Module#

ingraph.aws.aws_qldb

Resources#

Elastic Beanstalk#

Module#

ingraph.aws.aws_elasticbeanstalk

Resources#

RoboMaker#

Module#

ingraph.aws.aws_robomaker

Resources#

Amazon Cognito#

Module#

ingraph.aws.aws_cognito

Resources#

IoT Analytics#

Module#

ingraph.aws.aws_iotanalytics

Resources#

Amazon Redshift#

Module#

ingraph.aws.aws_redshift

Resources#

WAFv2#

Module#

ingraph.aws.aws_wafv2

Resources#

AppStream 2.0#

Module#

ingraph.aws.aws_appstream

Resources#

ASK#

Module#

ingraph.aws.alexa_ask

Resources#

Pinpoint#

Module#

ingraph.aws.aws_pinpoint

Resources#

Secrets Manager#

Module#

ingraph.aws.aws_secretsmanager

Resources#

OpsWorks-CM#

Module#

ingraph.aws.aws_opsworkscm

Resources#

Amazon SNS#

Module#

ingraph.aws.aws_sns

Resources#

MSK#

Module#

ingraph.aws.aws_msk

Resources#

WAF Regional#

Module#

ingraph.aws.aws_wafregional

Resources#

CodeCommit#

Module#

ingraph.aws.aws_codecommit

Resources#

SES#

Module#

ingraph.aws.aws_ses

Resources#

Elasticsearch#

Module#

ingraph.aws.aws_elasticsearch

Resources#

Amplify Console#

Module#

ingraph.aws.aws_amplify

Resources#

PinpointEmail#

Module#

ingraph.aws.aws_pinpointemail

Resources#

Amazon EventBridge#

Module#

ingraph.aws.aws_events

Resources#

ACMPCA#

Module#

ingraph.aws.aws_acmpca

Resources#

KinesisAnalytics#

Module#

ingraph.aws.aws_kinesisanalytics

Resources#

LakeFormation#

Module#

ingraph.aws.aws_lakeformation

Resources#

Amazon S3#

Module#

ingraph.aws.aws_s3

Resources#

EC2#

Module#

ingraph.aws.aws_ec2

Resources#

Inspector#

Module#

ingraph.aws.aws_inspector

Resources#

AWS Batch#

Module#

ingraph.aws.aws_batch

Resources#

AWS Cloud Map#

Module#

ingraph.aws.aws_servicediscovery

Resources#

AccessAnalyzer#

Module#

ingraph.aws.aws_accessanalyzer

Resources#

IoTEvents#

Module#

ingraph.aws.aws_iotevents

Resources#

AWS Glue#

Module#

ingraph.aws.aws_glue

Resources#

AWS IoT Greengrass#

Module#

ingraph.aws.aws_greengrass

Resources#

EFS#

Module#

ingraph.aws.aws_efs

Resources#

Athena#

Module#

ingraph.aws.aws_athena

Resources#

ECS#

Module#

ingraph.aws.aws_ecs

Resources#

Amazon Neptune#

Module#

ingraph.aws.aws_neptune

Resources#

KMS#

Module#

ingraph.aws.aws_kms

Resources#

CodeDeploy#

Module#

ingraph.aws.aws_codedeploy

Resources#

WAF#

Module#

ingraph.aws.aws_waf

Resources#

Application Auto Scaling#

Module#

ingraph.aws.aws_applicationautoscaling

Resources#

CloudWatch#

Module#

ingraph.aws.aws_cloudwatch

Resources#

Certificate Manager#

Module#

ingraph.aws.aws_certificatemanager

Resources#

Cassandra#

Module#

ingraph.aws.aws_cassandra

Resources#

CodeStar#

Module#

ingraph.aws.aws_codestar

Resources#

NetworkManager#

Module#

ingraph.aws.aws_networkmanager

Resources#

Config#

Module#

ingraph.aws.aws_config

Resources#