After developing and using this Clojure wrapper for AWS CDK for the pastsix months, we've decided to use TypeScript and AWS' library directly. We arediscontinuing maintenance moving forward. If a member of the community wouldlike to volunteer for future maintenance, please file an issue or reach outdirectly to discuss a possible transfer.
This library is a Clojure wrapper for AWS Cloud Development Kit (AWS CDK).
This is an alpha release. We use this library internally and consider itstable. Nonetheless, we may still make minor changes to the API.
From AWS:
The AWS Cloud Development Kit (AWS CDK) is an open-source software developmentframework to define cloud infrastructure in code and provision it through AWSCloudFormation.
It offers a high-level object-oriented abstraction to define AWS resourcesimperatively using the power of modern programming languages. Using the CDK'slibrary of infrastructure constructs, you can easily encapsulate AWS bestpractices in your infrastructure definition and share it without worrying aboutboilerplate logic.
CDK is built on Amazon's jsii project, which allows TypeScript projects tobe shared across Python, JavaScript, Java and C# via code generation.
cdk-clj
taps into this ecosystem directly by consuming the jsii
protocol andbringing infrastructure to the REPL. REPL-driven infrastructure turns afrustrating practice with long feedback cycles into an enjoyable experience withimmediate feedback and makes it possible for Clojure code to be deployed to AWSwith minimal configuration.
For a general introduction, watch the Clojure/Conj talk:
cdk-clj
requires:
Ensure you have configured appropriate AWS Credentials.The following commands assume a default profile.
Install aws-cdk
:
npm install -g aws-cdk
deps.edn
file. You will also need to include the Maven dependency for anyCDK modules you are using. You can find all the available moduleshere.{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.10.1"}}
:aliases {:dev {:extra-paths ["cdk"]
:extra-deps {stedi/cdk-clj {:git/url "https://github.com/StediInc/cdk-clj.git"
:sha "<LATEST SHA HERE>"}
;; Required in order to use the "@aws-cdk/aws-s3" module below
software.amazon.awscdk/s3 {:mvn/version "1.20.0"}
}}}}
./cdk/stedi/my_app/cdk.clj
.(ns stedi.my-app.cdk
(:require [stedi.cdk.alpha :as cdk]))
(cdk/import [[Stack] :from "@aws-cdk/core"]
[[Bucket] :from "@aws-cdk/aws-s3"])
(defn AppStack
[scope id props]
(let [stack (Stack scope id props)]
(Bucket stack "my-bucket" {:versioned true})))
(cdk/defapp app
[this]
(AppStack this "my-app-dev" {}))
cdk.json
inthe root of your project to tell the CDK toolchain how to invoke the app:{"app":"clojure -A:dev -i cdk/stedi/my_app/cdk.clj"}
where the argument to -i
is the path to the file in which the cdk-clj app isdefined.
cdk ls
# should return `my-app-dev`
cdk synth my-app-dev
cdk deploy my-app-dev
jsii is a protocol that allows TypeScript classes and objects to beconsumed via an RPC protocol. This protocol exposes the ability to:
CDK exposes its functionality via this API to allow non-JavaScript programminglanguages to benefit from the functionality it provides.cdk-clj
maps these operations into Clojure friendly equivalents. The CDK libraryrelies heavily on object oriented principles and cdk-clj
does not shy away fromthose concepts. Instead, it embraces them and maps them into a Clojure-friendlyinterface. In doing so, it makes the CDK documentation directly mappable toClojure.
There are two types introduced by this library: CDKClass
andCDKObject
. Together, they expose all of the functionality of the jsii
protocol by implementing the clojure.lang.ILookup
and clojure.lang.IFn
interfaces:
Instantiate an object from a class
;; Creates a bucket based on the CDK class @aws-cdk/aws-s3.Bucket
(cdk/import [[Bucket] :from "@aws-cdk/aws-s3"])
(def bucket (Bucket parent "my-bucket" {}))
Get property of an object
;; Gets the bucketArn property off of the bucket instance
(:bucketArn bucket)
Set property of an object
;; TODO: not implemented yet
Call a method on an object
;; Grants READ permission to the lambda-function object
(cdk/import [[Bucket] :from "@aws-cdk/aws-s3"])
(Bucket/grantRead bucket lambda-function)
Get static property of a class
(cdk/import [[Runtime] :from "@aws-cdk/aws-lambda"])
;; Get the JAVA8 runtime instance
(:JAVA_8 Runtime)
Set static property of an object
;; TODO: not implemented yet
Call static method on class
(cdk/import [[Code] :from "@aws-cdk/aws-lambda"])
;; Refer to the src directory as an asset to be uploaded
(Code/asset "src")
This error is non-specific and is raised on any failure to launchthe runtime process, not just the missing executable named; that the causativeexception is not chained makes this harder to debug.
One possible cause is not having the Node.js executable (i.e.,node
) on the PATH
given to the JVM. If you're using a Node version orvirtual environment manager, add the appropriate directory to the JVMenvironment.
Contributors are welcome to submit issues, bug reports, and featurerequests. Presently, we do not accept pull requests.
cdk-clj is distributed under the Apache License, Version 2.0.
See LICENSE for more information.
2003 cdk When dealing with a large amount of content, you may find it useful to add an infinite scroll feature to your site. When I say infinite scrolling, I’m referring to a page appending new conten
HTML <div (click)="showOverlayPanelConnectTemplate()" #connectTemplateOrigin >{{title}}</div> <ng-template cdkConnectedOverlay nzConnectedOverlay #overlayConnectTemplate> </ng-templat
CDK里面Portals模块的功能就是将动态内容(这个内容可以是Component也可以是一个TemplateRef)呈现到应用程序中。更加直接点的解释就是把Portal放到指定位置(我们把他叫做插槽PortalOutlet)。Portal有两个子类ComponentPortal(对应组件)或者TemplatePortal(对应TemplateRef)。 Portal:表示内容。Po
化学开发工具包(CDK)是一个结构化学和生物信息学的Java库。来自世界各地,并在10多个不同的学术以及世界各地的工业项目开发。
我有一个Powershell Lambda,我希望通过AWS CDK部署它,但在运行时遇到问题。 通过手动发布AWSPowerShellLambda部署Powershell可以: 但是,与CDK一起部署的同一脚本不会记录到CloudWatch日志,即使它具有以下权限: powershell脚本当前仅包含以下行,在CLI上由Publish AWSPowerShellLambda部署时可以工作: 注意
AWS Cloud Development Kit (AWS CDK) The AWS Cloud Development Kit (AWS CDK) is an open-source software developmentframework to define cloud infrastructure in code and provision it through AWS CloudFor
Awesome CDK Curated list of awesome AWS Cloud Development Kit (AWS CDK) open-source projects, guides, blogs and other resources. The AWS Cloud Development Kit (AWS CDK) is an open-source software deve
@cloudcomponents/cdk-constructs A collection of higher-level reusable cdk constructs Constructs This repository is a monorepo managed with Lerna. Several constructs are published to pypi and npm from
AWS CDK RFCs This repo is a place to propose and track major upcoming changes to AWS CDK, jsii, andother related projects. It also is a great place to learn about the current andfuture state of the li