Skip to content

Commit c6a096b

Browse files
author
Ashwin Raj Purushothaman
committed
first commit
0 parents  commit c6a096b

22 files changed

+1320
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Python
2+
.venv/
3+
__pycache__/
4+
*.pyc
5+
6+
# CDK
7+
cdk.out/
8+
9+
# OS / Editor
10+
.DS_Store
11+
.vscode/
12+
13+
# Tests
14+
.pytest_cache/

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
# Welcome to your CDK Python project!
3+
4+
This is a blank project for CDK development with Python.
5+
6+
The `cdk.json` file tells the CDK Toolkit how to execute your app.
7+
8+
This project is set up like a standard Python project. The initialization
9+
process also creates a virtualenv within this project, stored under the `.venv`
10+
directory. To create the virtualenv it assumes that there is a `python3`
11+
(or `python` for Windows) executable in your path with access to the `venv`
12+
package. If for any reason the automatic creation of the virtualenv fails,
13+
you can create the virtualenv manually.
14+
15+
To manually create a virtualenv on MacOS and Linux:
16+
17+
```
18+
$ python3 -m venv .venv
19+
```
20+
21+
After the init process completes and the virtualenv is created, you can use the following
22+
step to activate your virtualenv.
23+
24+
```
25+
$ source .venv/bin/activate
26+
```
27+
28+
If you are a Windows platform, you would activate the virtualenv like this:
29+
30+
```
31+
% .venv\Scripts\activate.bat
32+
```
33+
34+
Once the virtualenv is activated, you can install the required dependencies.
35+
36+
```
37+
$ pip install -r requirements.txt
38+
```
39+
40+
At this point you can now synthesize the CloudFormation template for this code.
41+
42+
```
43+
$ cdk synth
44+
```
45+
46+
To add additional dependencies, for example other CDK libraries, just add
47+
them to your `requirements.txt` file and rerun the `python -m pip install -r requirements.txt`
48+
command.
49+
50+
## Useful commands
51+
52+
* `cdk ls` list all stacks in the app
53+
* `cdk synth` emits the synthesized CloudFormation template
54+
* `cdk deploy` deploy this stack to your default AWS account/region
55+
* `cdk diff` compare deployed stack with current state
56+
* `cdk docs` open CDK documentation
57+
58+
Enjoy!

app.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
import os
3+
4+
import aws_cdk as cdk
5+
6+
from cdk_git.cdk_git_stack import CdkGitStack
7+
8+
9+
app = cdk.App()
10+
CdkGitStack(app, "CdkGitStack",
11+
# If you don't specify 'env', this stack will be environment-agnostic.
12+
# Account/Region-dependent features and context lookups will not work,
13+
# but a single synthesized template can be deployed anywhere.
14+
15+
# Uncomment the next line to specialize this stack for the AWS Account
16+
# and Region that are implied by the current CLI configuration.
17+
18+
#env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),
19+
20+
# Uncomment the next line if you know exactly what Account and Region you
21+
# want to deploy the stack to. */
22+
23+
#env=cdk.Environment(account='123456789012', region='us-east-1'),
24+
25+
# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
26+
)
27+
28+
app.synth()

cdk.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"app": "python3 app.py",
3+
"watch": {
4+
"include": [
5+
"**"
6+
],
7+
"exclude": [
8+
"README.md",
9+
"cdk*.json",
10+
"requirements*.txt",
11+
"source.bat",
12+
"**/__init__.py",
13+
"**/__pycache__",
14+
"tests"
15+
]
16+
},
17+
"context": {
18+
"@aws-cdk/aws-signer:signingProfileNamePassedToCfn": true,
19+
"@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": true,
20+
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
21+
"@aws-cdk/core:checkSecretUsage": true,
22+
"@aws-cdk/core:target-partitions": [
23+
"aws",
24+
"aws-cn"
25+
],
26+
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
27+
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
28+
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
29+
"@aws-cdk/aws-iam:minimizePolicies": true,
30+
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
31+
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
32+
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
33+
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
34+
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
35+
"@aws-cdk/core:enablePartitionLiterals": true,
36+
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
37+
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
38+
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
39+
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
40+
"@aws-cdk/aws-route53-patters:useCertificate": true,
41+
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
42+
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
43+
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
44+
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
45+
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
46+
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
47+
"@aws-cdk/aws-redshift:columnId": true,
48+
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
49+
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
50+
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
51+
"@aws-cdk/aws-kms:aliasNameRef": true,
52+
"@aws-cdk/aws-kms:applyImportedAliasPermissionsToPrincipal": true,
53+
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
54+
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
55+
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
56+
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
57+
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
58+
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true,
59+
"@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true,
60+
"@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true,
61+
"@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true,
62+
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
63+
"@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true,
64+
"@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true,
65+
"@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true,
66+
"@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true,
67+
"@aws-cdk/aws-eks:nodegroupNameAttribute": true,
68+
"@aws-cdk/aws-eks:useNativeOidcProvider": true,
69+
"@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true,
70+
"@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true,
71+
"@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false,
72+
"@aws-cdk/aws-s3:keepNotificationInImportedBucket": false,
73+
"@aws-cdk/core:explicitStackTags": true,
74+
"@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true,
75+
"@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": true,
76+
"@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true,
77+
"@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": true,
78+
"@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true,
79+
"@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": true,
80+
"@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages": true,
81+
"@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": true,
82+
"@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault": true,
83+
"@aws-cdk/aws-route53-targets:userPoolDomainNameMethodWithoutCustomResource": true,
84+
"@aws-cdk/aws-elasticloadbalancingV2:albDualstackWithoutPublicIpv4SecurityGroupRulesDefault": true,
85+
"@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections": true,
86+
"@aws-cdk/core:enableAdditionalMetadataCollection": true,
87+
"@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy": false,
88+
"@aws-cdk/aws-s3:setUniqueReplicationRoleName": true,
89+
"@aws-cdk/aws-events:requireEventBusPolicySid": true,
90+
"@aws-cdk/core:aspectPrioritiesMutating": true,
91+
"@aws-cdk/aws-dynamodb:retainTableReplica": true,
92+
"@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2": true,
93+
"@aws-cdk/s3-notifications:addS3TrustKeyPolicyForSnsSubscriptions": true,
94+
"@aws-cdk/aws-ec2:requirePrivateSubnetsForEgressOnlyInternetGateway": true,
95+
"@aws-cdk/aws-s3:publicAccessBlockedByDefault": true,
96+
"@aws-cdk/aws-lambda:useCdkManagedLogGroup": true,
97+
"@aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault": true,
98+
"@aws-cdk/aws-ecs-patterns:uniqueTargetGroupId": true,
99+
"@aws-cdk/aws-route53-patterns:useDistribution": true
100+
}
101+
}
Binary file not shown.

cdk.out/CdkGitStack.assets.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "48.0.0",
3+
"files": {
4+
"8cc98dad2df8adcfb1768d469fccc848693d4f8e121724e39f8968d4030c02ec": {
5+
"displayName": "TestPythonLambda/Code",
6+
"source": {
7+
"path": "asset.8cc98dad2df8adcfb1768d469fccc848693d4f8e121724e39f8968d4030c02ec",
8+
"packaging": "zip"
9+
},
10+
"destinations": {
11+
"current_account-current_region-d0d1a111": {
12+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
13+
"objectKey": "8cc98dad2df8adcfb1768d469fccc848693d4f8e121724e39f8968d4030c02ec.zip",
14+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
15+
}
16+
}
17+
},
18+
"0029c0df00b5f5f81bdd46e5ce2de3bfca38b3a0500835d36912433dabc82baf": {
19+
"displayName": "CdkGitStack Template",
20+
"source": {
21+
"path": "CdkGitStack.template.json",
22+
"packaging": "file"
23+
},
24+
"destinations": {
25+
"current_account-current_region-67dff71f": {
26+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
27+
"objectKey": "0029c0df00b5f5f81bdd46e5ce2de3bfca38b3a0500835d36912433dabc82baf.json",
28+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
29+
}
30+
}
31+
}
32+
},
33+
"dockerImages": {}
34+
}

0 commit comments

Comments
 (0)