Skip to content

Commit

Permalink
release python version (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowiow authored Apr 13, 2021
1 parent fe5147c commit 4e9be67
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 15 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ jobs:
run: npm run build
- name: Package
run: npm run package
- name: Authenticate with Registry
- name: Publish to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- name: Publish
run: npm publish --access public
run: npm run release-npm
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
run: npm run release-pypi
67 changes: 63 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,30 @@ basic-auth RDS via username and password or IAM, as well as to Redis clusters.

# Setup

First of all you need to include this library into your project via npm
First of all you need to include this library into your project for the language
you want to deploy the bastion host with

## Javascript/Typescript

For Javascript/Typescript the library can be installed via npm:

```
npm install @moia-dev/bastion-host-forward
```

## Instantiating the Bastion Host for RDS
## Python

For python the library can be installed via pip:

```
pip install moia-dev.bastion-host-forward
```

# Examples
The following section includes some examples in supported languages how the
Bastion Host can be created for different databases.

## Creating the Bastion Host for RDS in Typescript

A minimal example for creating the RDS Forward Construct, which will be used via
username/password could look like this snippet:
Expand Down Expand Up @@ -80,7 +97,7 @@ that IPs from within the VPC are able to connect to the RDS Database. This
needs to be set in the RDS's Security Group. Otherwise the Bastion Host can't
connect to the RDS.
## Instantiating the Bastion Host for Redis
## Creating the Bastion Host for Redis in Typescript
The instantiation of a BastionHostRedisForward works very similar to the RDS
example, except that you pass a CfnCacheCluster to the BastionHost like this:
Expand All @@ -92,7 +109,9 @@ new BastionHostRedisForward(this, 'RedisBastion', {
});
```
## Instantiating the Bastion Host for Redshift
## Creating the Bastion Host for Redshift
### Typescript
A minimal example for creating the Redshift Forward Construct, which will be used via
username/password could look like this snippet. It's very similar to the RDS
Expand Down Expand Up @@ -137,6 +156,46 @@ export class PocRedshiftStack extends cdk.Stack {
}
```
### Python
```python
from aws_cdk import core as cdk
from aws_cdk import aws_redshift
from aws_cdk import aws_ec2
from moia_dev import bastion_host_forward


class PocRedshiftStack(cdk.Stack):

def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
vpc = aws_ec2.Vpc.from_lookup(
self,
"vpc",
vpc_id="vpc-12345678"
)
security_group = aws_ec2.SecurityGroup.from_security_group_id(
self,
"sec_group", "sg-12345678"
)
redshiftCluster = aws_redshift.Cluster.from_cluster_attributes(
self,
"cluster",
cluster_name="myRedshiftClusterName",
cluster_endpoint_address="myRedshiftClusterName.abcdefg.eu-central-1.redshift.amazonaws.com",
cluster_endpoint_port=5439
)

bastion_host_forward.BastionHostRedshiftForward(
self,
"bastion-host",
name="my-vastion-host",
security_group=security_group,
redshift_cluster=redshiftCluster,
vpc=vpc
)
```
## Deploying the Bastion Host
When you setup the Bastion Host for the Database you want to connect to, you can
Expand Down
64 changes: 59 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@
"url": "https://github.com/moia-oss/bastion-host-forward"
},
"license": "Apache-2.0",
"version": "0.7.0",
"version": "0.7.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "jsii",
"watch": "jsii -w",
"package": "jsii-pacmak",
"release-npm": "jsii-release-npm",
"release-pypi": "jsii-release-pypi",
"test": "jest",
"lint": "tslint --project tsconfig.json --config tslint.yaml"
},
"jsii": {
"outdir": "dist",
"targets": {}
"targets": {
"python": {
"distName": "moia-dev.bastion-host-forward",
"module": "moia_dev.bastion_host_forward"
}
}
},
"devDependencies": {
"@aws-cdk/assert": "^1.97.0",
Expand All @@ -29,6 +36,7 @@
"jest": "^25.5.4",
"jsii": "^1.26.0",
"jsii-pacmak": "^1.26.0",
"jsii-release": "^0.2.18",
"ts-jest": "^25.5.1",
"tslint": "^6.1.3",
"typescript": "^3.9.7"
Expand Down

0 comments on commit 4e9be67

Please sign in to comment.