cdk-preinstalled-amazon-linux-ec2 0.0.0__py3-none-any.whl → 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cdk_preinstalled_amazon_linux_ec2/__init__.py +92 -1
- cdk_preinstalled_amazon_linux_ec2/_jsii/__init__.py +2 -2
- cdk_preinstalled_amazon_linux_ec2/_jsii/cdk-preinstalled-amazon-linux-ec2@0.0.1.jsii.tgz +0 -0
- cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/METADATA +120 -0
- cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/RECORD +9 -0
- cdk_preinstalled_amazon_linux_ec2/_jsii/cdk-preinstalled-amazon-linux-ec2@0.0.0.jsii.tgz +0 -0
- cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/METADATA +0 -29
- cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/RECORD +0 -9
- {cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info → cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info}/LICENSE +0 -0
- {cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info → cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info}/WHEEL +0 -0
- {cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info → cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,96 @@
|
|
1
1
|
'''
|
2
|
-
#
|
2
|
+
# CDK Preinstalled Amazon Linux EC2 Instance Construct
|
3
|
+
|
4
|
+
This is a CDK Construct for creating a preinstalled AmazonLinux EC2 instance.
|
5
|
+
|
6
|
+
You can use Node.js, Visual Studio Code, git and other software as soon as the EC2 instance starts.
|
7
|
+
|
8
|
+
[](https://constructs.dev/packages/cdk-preinstalled-amazon-linux-ec2)
|
9
|
+
|
10
|
+
[](https://open.vscode.dev/badmintoncryer/cdk-preinstalled-amazon-linux-ec2)
|
11
|
+
[](https://badge.fury.io/js/cdk-preinstalled-amazon-linux-ec2)
|
12
|
+
[](https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2/actions/workflows/build.yml)
|
13
|
+
[](https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2/actions/workflows/release.yml)
|
14
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
15
|
+
[](https://www.npmjs.com/package/cdk-preinstalled-amazon-linux-ec2)
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Install the package:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
npm install cdk-preinstalled-amazon-linux-ec2
|
23
|
+
```
|
24
|
+
|
25
|
+
Use it in your CDK stack:
|
26
|
+
|
27
|
+
```python
|
28
|
+
import { PreinstalledAmazonLinuxInstance } from 'cdk-preinstalled-amazon-linux-ec2';
|
29
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
30
|
+
|
31
|
+
declare const vpc: ec2.IVpc;
|
32
|
+
|
33
|
+
// You can configure all properties of the EC2 instance
|
34
|
+
new PreinstalledAmazonLinuxInstance(this, 'Instance', {
|
35
|
+
vpc,
|
36
|
+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
|
37
|
+
machineImage: new ec2.AmazonLinuxImage({
|
38
|
+
generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023,
|
39
|
+
}),
|
40
|
+
// Specify preinstalled software
|
41
|
+
preinstalledSoftware: {
|
42
|
+
type: [
|
43
|
+
PreinstalledSoftwareType.NODEJS,
|
44
|
+
PreinstalledSoftwareType.VSCODE,
|
45
|
+
PreinstalledSoftwareType.GIT,
|
46
|
+
],
|
47
|
+
others: ['rsyslog'], // You can specify other software packages. These parameters are used as `sudo dnf install ${parameter}`
|
48
|
+
});
|
49
|
+
```
|
50
|
+
|
51
|
+
After the stack is deployed, you can SSH into the EC2 instance and use Node.js:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$ ssh ec2-user@<public-ip>
|
55
|
+
$ node --version
|
56
|
+
v20.13.1
|
57
|
+
$ code --version
|
58
|
+
1.89.1
|
59
|
+
$ git --version
|
60
|
+
git version 2.39.3
|
61
|
+
```
|
62
|
+
|
63
|
+
## user data
|
64
|
+
|
65
|
+
Installation of software is done by user data script. You can see the script in the `src/index.ts` file.
|
66
|
+
|
67
|
+
```python
|
68
|
+
// Install Node.js
|
69
|
+
userData.addCommands(
|
70
|
+
'touch ~/.bashrc',
|
71
|
+
'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash',
|
72
|
+
'source ~/.bashrc',
|
73
|
+
'export NVM_DIR="$HOME/.nvm"',
|
74
|
+
'[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"',
|
75
|
+
`nvm install ${props.nodeJsVersion ?? '--lts'}`,
|
76
|
+
// Note that the above will install nvm, node and npm for the root user.
|
77
|
+
// It will not add the correct ENV VAR in ec2-user's environment.
|
78
|
+
`cat <<EOF >> /home/ec2-user/.bashrc
|
79
|
+
export NVM_DIR="/.nvm"
|
80
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
81
|
+
EOF`);
|
82
|
+
```
|
83
|
+
|
84
|
+
Ofcourse, you can customize the additional user data script by calling `instance.userData.addCommands()` method.
|
85
|
+
|
86
|
+
```python
|
87
|
+
declare const instance: PreinstalledAmazonLinuxInstance;
|
88
|
+
|
89
|
+
// install Postgresql
|
90
|
+
instance.userData.addCommands(
|
91
|
+
'sudo dnf install -y postgresql15-server'
|
92
|
+
);
|
93
|
+
```
|
3
94
|
'''
|
4
95
|
from pkgutil import extend_path
|
5
96
|
__path__ = extend_path(__path__, __name__)
|
@@ -18,9 +18,9 @@ import constructs._jsii
|
|
18
18
|
|
19
19
|
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
20
20
|
"cdk-preinstalled-amazon-linux-ec2",
|
21
|
-
"0.0.
|
21
|
+
"0.0.1",
|
22
22
|
__name__[0:-6],
|
23
|
-
"cdk-preinstalled-amazon-linux-ec2@0.0.
|
23
|
+
"cdk-preinstalled-amazon-linux-ec2@0.0.1.jsii.tgz",
|
24
24
|
)
|
25
25
|
|
26
26
|
__all__ = [
|
Binary file
|
@@ -0,0 +1,120 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: cdk-preinstalled-amazon-linux-ec2
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: CDK Construct for creating an Amazon Linux EC2 instance with pre-installed software
|
5
|
+
Home-page: https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2.git
|
6
|
+
Author: Kazuho CryerShinozuka<malaysia.cryer@gmail.com>
|
7
|
+
License: Apache-2.0
|
8
|
+
Project-URL: Source, https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2.git
|
9
|
+
Classifier: Intended Audience :: Developers
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Programming Language :: JavaScript
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Typing :: Typed
|
18
|
+
Classifier: Development Status :: 5 - Production/Stable
|
19
|
+
Classifier: License :: OSI Approved
|
20
|
+
Requires-Python: ~=3.8
|
21
|
+
Description-Content-Type: text/markdown
|
22
|
+
License-File: LICENSE
|
23
|
+
Requires-Dist: aws-cdk-lib <3.0.0,>=2.143.0
|
24
|
+
Requires-Dist: constructs <11.0.0,>=10.0.5
|
25
|
+
Requires-Dist: jsii <2.0.0,>=1.98.0
|
26
|
+
Requires-Dist: publication >=0.0.3
|
27
|
+
Requires-Dist: typeguard ~=2.13.3
|
28
|
+
|
29
|
+
# CDK Preinstalled Amazon Linux EC2 Instance Construct
|
30
|
+
|
31
|
+
This is a CDK Construct for creating a preinstalled AmazonLinux EC2 instance.
|
32
|
+
|
33
|
+
You can use Node.js, Visual Studio Code, git and other software as soon as the EC2 instance starts.
|
34
|
+
|
35
|
+
[](https://constructs.dev/packages/cdk-preinstalled-amazon-linux-ec2)
|
36
|
+
|
37
|
+
[](https://open.vscode.dev/badmintoncryer/cdk-preinstalled-amazon-linux-ec2)
|
38
|
+
[](https://badge.fury.io/js/cdk-preinstalled-amazon-linux-ec2)
|
39
|
+
[](https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2/actions/workflows/build.yml)
|
40
|
+
[](https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2/actions/workflows/release.yml)
|
41
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
42
|
+
[](https://www.npmjs.com/package/cdk-preinstalled-amazon-linux-ec2)
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
Install the package:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
npm install cdk-preinstalled-amazon-linux-ec2
|
50
|
+
```
|
51
|
+
|
52
|
+
Use it in your CDK stack:
|
53
|
+
|
54
|
+
```python
|
55
|
+
import { PreinstalledAmazonLinuxInstance } from 'cdk-preinstalled-amazon-linux-ec2';
|
56
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
57
|
+
|
58
|
+
declare const vpc: ec2.IVpc;
|
59
|
+
|
60
|
+
// You can configure all properties of the EC2 instance
|
61
|
+
new PreinstalledAmazonLinuxInstance(this, 'Instance', {
|
62
|
+
vpc,
|
63
|
+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
|
64
|
+
machineImage: new ec2.AmazonLinuxImage({
|
65
|
+
generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023,
|
66
|
+
}),
|
67
|
+
// Specify preinstalled software
|
68
|
+
preinstalledSoftware: {
|
69
|
+
type: [
|
70
|
+
PreinstalledSoftwareType.NODEJS,
|
71
|
+
PreinstalledSoftwareType.VSCODE,
|
72
|
+
PreinstalledSoftwareType.GIT,
|
73
|
+
],
|
74
|
+
others: ['rsyslog'], // You can specify other software packages. These parameters are used as `sudo dnf install ${parameter}`
|
75
|
+
});
|
76
|
+
```
|
77
|
+
|
78
|
+
After the stack is deployed, you can SSH into the EC2 instance and use Node.js:
|
79
|
+
|
80
|
+
```bash
|
81
|
+
$ ssh ec2-user@<public-ip>
|
82
|
+
$ node --version
|
83
|
+
v20.13.1
|
84
|
+
$ code --version
|
85
|
+
1.89.1
|
86
|
+
$ git --version
|
87
|
+
git version 2.39.3
|
88
|
+
```
|
89
|
+
|
90
|
+
## user data
|
91
|
+
|
92
|
+
Installation of software is done by user data script. You can see the script in the `src/index.ts` file.
|
93
|
+
|
94
|
+
```python
|
95
|
+
// Install Node.js
|
96
|
+
userData.addCommands(
|
97
|
+
'touch ~/.bashrc',
|
98
|
+
'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash',
|
99
|
+
'source ~/.bashrc',
|
100
|
+
'export NVM_DIR="$HOME/.nvm"',
|
101
|
+
'[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"',
|
102
|
+
`nvm install ${props.nodeJsVersion ?? '--lts'}`,
|
103
|
+
// Note that the above will install nvm, node and npm for the root user.
|
104
|
+
// It will not add the correct ENV VAR in ec2-user's environment.
|
105
|
+
`cat <<EOF >> /home/ec2-user/.bashrc
|
106
|
+
export NVM_DIR="/.nvm"
|
107
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
108
|
+
EOF`);
|
109
|
+
```
|
110
|
+
|
111
|
+
Ofcourse, you can customize the additional user data script by calling `instance.userData.addCommands()` method.
|
112
|
+
|
113
|
+
```python
|
114
|
+
declare const instance: PreinstalledAmazonLinuxInstance;
|
115
|
+
|
116
|
+
// install Postgresql
|
117
|
+
instance.userData.addCommands(
|
118
|
+
'sudo dnf install -y postgresql15-server'
|
119
|
+
);
|
120
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
cdk_preinstalled_amazon_linux_ec2/__init__.py,sha256=h6Dq9xWt70Sje-6O2masJy5dvaM8sFRnwSS_ega_-oc,54253
|
2
|
+
cdk_preinstalled_amazon_linux_ec2/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
|
+
cdk_preinstalled_amazon_linux_ec2/_jsii/__init__.py,sha256=BBYXv7O3h3NTKS6QHJSOXf73al1XNguyzek9cWVxYA4,522
|
4
|
+
cdk_preinstalled_amazon_linux_ec2/_jsii/cdk-preinstalled-amazon-linux-ec2@0.0.1.jsii.tgz,sha256=za09MS9gAK2_ZG1oLbxTfRbRw5rtVKzJA16TdgAYh20,26914
|
5
|
+
cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
6
|
+
cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/METADATA,sha256=c5xr6UlEOjlyKUCjml0nvFXpj4QJHkIq1CfdiPprglM,4879
|
7
|
+
cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
8
|
+
cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/top_level.txt,sha256=9-8USjq8vvN9Bm7BW8jTqhraimVCCUkpIUNhfVgADkk,34
|
9
|
+
cdk_preinstalled_amazon_linux_ec2-0.0.1.dist-info/RECORD,,
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: cdk-preinstalled-amazon-linux-ec2
|
3
|
-
Version: 0.0.0
|
4
|
-
Summary: CDK Construct for creating an Amazon Linux EC2 instance with pre-installed software
|
5
|
-
Home-page: https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2.git
|
6
|
-
Author: Kazuho CryerShinozuka<malaysia.cryer@gmail.com>
|
7
|
-
License: Apache-2.0
|
8
|
-
Project-URL: Source, https://github.com/badmintoncryer/cdk-preinstalled-amazon-linux-ec2.git
|
9
|
-
Classifier: Intended Audience :: Developers
|
10
|
-
Classifier: Operating System :: OS Independent
|
11
|
-
Classifier: Programming Language :: JavaScript
|
12
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
17
|
-
Classifier: Typing :: Typed
|
18
|
-
Classifier: Development Status :: 5 - Production/Stable
|
19
|
-
Classifier: License :: OSI Approved
|
20
|
-
Requires-Python: ~=3.8
|
21
|
-
Description-Content-Type: text/markdown
|
22
|
-
License-File: LICENSE
|
23
|
-
Requires-Dist: aws-cdk-lib <3.0.0,>=2.143.0
|
24
|
-
Requires-Dist: constructs <11.0.0,>=10.0.5
|
25
|
-
Requires-Dist: jsii <2.0.0,>=1.98.0
|
26
|
-
Requires-Dist: publication >=0.0.3
|
27
|
-
Requires-Dist: typeguard ~=2.13.3
|
28
|
-
|
29
|
-
# replace this
|
@@ -1,9 +0,0 @@
|
|
1
|
-
cdk_preinstalled_amazon_linux_ec2/__init__.py,sha256=VkgGwRKWjfj_vCPGykdwG3Gk_3zdyf4XWh-Xb7jKBoU,50605
|
2
|
-
cdk_preinstalled_amazon_linux_ec2/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
|
-
cdk_preinstalled_amazon_linux_ec2/_jsii/__init__.py,sha256=6KqpVggyI2FpFeVjyYVGrMc32yMaNSqTqBBS6VLKMI4,522
|
4
|
-
cdk_preinstalled_amazon_linux_ec2/_jsii/cdk-preinstalled-amazon-linux-ec2@0.0.0.jsii.tgz,sha256=Q6PPsN_DupqgV9qk_ZOzuHiDljNfKI9OH8ir473EBlM,24510
|
5
|
-
cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
6
|
-
cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/METADATA,sha256=d0dLVeF3UFAMeWECIRIXSJysFhRLJJgbtfSGuRy6Pyo,1231
|
7
|
-
cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
8
|
-
cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/top_level.txt,sha256=9-8USjq8vvN9Bm7BW8jTqhraimVCCUkpIUNhfVgADkk,34
|
9
|
-
cdk_preinstalled_amazon_linux_ec2-0.0.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|