Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
feat: add library constructs
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipPyrek committed Apr 23, 2024
1 parent a71f7a5 commit 4ae93d8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions presets/library/ec2-instance-control-panel/preset.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { extend, extract } from '../../../src/index.js'

export default [extend('presets/base/typescript-cdk'), extract()]
25 changes: 25 additions & 0 deletions presets/library/ec2-instance-control-panel/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<p align="center">
<a href="https://buttonize.io">
<img width="350" alt="Buttonize.io" src="https://user-images.githubusercontent.com/6282843/212024942-9fd50774-ea26-48ba-b2cf-ca2584498c9a.png">
</a>
</p>

---

## EC2 Instance Control Panel

[![EC2 Instance Control Panel](https://github.com/buttonize/create-buttonize/assets/6282843/cc28460e-7e9c-41f4-8d20-8f983d1d6227)](https://buttonize.io/library/ec2-instance-control-panel)

Learn more about EC2 Instance Control Panel Construct [here](https://buttonize.io/library/ec2-instance-control-panel).

## CDK

The `cdk.json` file tells the CDK Toolkit how to execute your app.

### Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npx cdk deploy` deploy this stack to your default AWS account/region
* `npx cdk diff` compare deployed stack with current state
* `npx cdk synth` emits the synthesized CloudFormation template
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as cdk from 'aws-cdk-lib'
import {
AmazonLinuxImage,
Instance,
InstanceClass,
InstanceSize,
InstanceType,
Vpc
} from 'aws-cdk-lib/aws-ec2'
import { Buttonize } from 'buttonize/cdk'
import { EC2InstanceControlPanel } from 'buttonize/library'
import { Construct } from 'constructs'

export class ExampleStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props)

Buttonize.init(this, {
apiKey: '@@apiKey'
})

const defaultVpc = Vpc.fromLookup(this, 'VPC', { isDefault: true })

const ec2Instance = new Instance(this, 'ec2Instance', {
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.MICRO),
machineImage: new AmazonLinuxImage(),
vpc: defaultVpc
})

new EC2InstanceControlPanel(this, 'ControlPanel', {
instance: ec2Instance
})
}
}

0 comments on commit 4ae93d8

Please sign in to comment.