Skip to content

Commit ded6c13

Browse files
author
Innokentii Kozlov
committed
create aws infra
1 parent ba6ff2a commit ded6c13

18 files changed

+7064
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: AWS Infra Deploy
2+
3+
4+
on:
5+
workflow_call:
6+
7+
8+
jobs:
9+
cloud-stack-deploy:
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: infrastructure/cloud
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js 18.x
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "18.x"
22+
23+
- name: Install Dependencies
24+
run: npm install
25+
26+
- name: Pulumi Up
27+
uses: pulumi/actions@v6
28+
with:
29+
command: up
30+
stack-name: prod
31+
work-dir: infrastructure/cloud
32+
env:
33+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
AWS_REGION: 'eu-north-1'
36+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: AWS Infra Destroy
2+
3+
4+
on:
5+
workflow_dispatch:
6+
7+
8+
jobs:
9+
cloud-stack-deploy:
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: infrastructure/cloud
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js 18.x
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "18.x"
22+
23+
- name: Install Dependencies
24+
run: npm install
25+
26+
- name: Pulumi Up
27+
uses: pulumi/actions@v6
28+
with:
29+
command: destroy
30+
stack-name: prod
31+
work-dir: infrastructure/cloud
32+
env:
33+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
AWS_REGION: 'eu-north-1'
36+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: AWS Stack Output
2+
3+
4+
on:
5+
workflow_call:
6+
7+
8+
jobs:
9+
cloud-stack-deploy:
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: infrastructure/cloud
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js 18.x
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "18.x"
22+
23+
- name: Install Dependencies
24+
run: npm install
25+
26+
- name: Pulumi Up
27+
uses: pulumi/actions@v6
28+
with:
29+
command: preview
30+
stack-name: prod
31+
work-dir: infrastructure/cloud
32+
env:
33+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
AWS_REGION: 'eu-north-1'
36+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Cloud Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/cloud-deploy.yaml"
9+
- ".github/workflows/aws-infra-deploy.yaml"
10+
- ".github/workflows/lint-iac.yaml"
11+
- "infrastructure/cloud/**"
12+
13+
14+
concurrency:
15+
group: ${{ github.workflow }}
16+
cancel-in-progress: true
17+
18+
19+
jobs:
20+
lint-iac:
21+
name: IaC Lint
22+
uses: ./.github/workflows/lint-iac.yaml
23+
secrets: inherit
24+
25+
aws-infra-deploy:
26+
name: AWS Infrastructure Deploy
27+
needs: lint-iac
28+
uses: ./.github/workflows/aws-infra-deploy.yaml
29+
secrets: inherit

.github/workflows/lint-iac.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint - IaC
2+
3+
4+
on:
5+
workflow_call:
6+
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: infrastructure/cloud
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "18.x"
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: Run linter
27+
run: npm run lint

infrastructure/cloud/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/bin/
2+
/node_modules/

infrastructure/cloud/.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
config:
2+
aws:region: eu-north-1
3+
nodejs-rest-api:data:
4+
project_name: nodejs-rest-api
5+
root_domain: innokentii-kozlov.com
6+
project_domain: nodejs-rest-api.innokentii-kozlov.com
7+
vpc:
8+
cidr: 10.0.0.0/28
9+
public_subnet_cidr: 10.0.0.0/28
10+
ami: ami-0548d28d4f7ec72c5
11+
tags:
12+
Project: nodejs-rest-api

infrastructure/cloud/Pulumi.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: nodejs-rest-api
2+
description: A minimal AWS TypeScript Pulumi program
3+
runtime:
4+
name: nodejs
5+
options:
6+
packagemanager: npm
7+
config:
8+
pulumi:tags:
9+
value:
10+
pulumi:template: aws-typescript

infrastructure/cloud/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# AWS TypeScript Pulumi Template
2+
3+
A minimal Pulumi template for provisioning AWS infrastructure using TypeScript. This template creates an Amazon S3 bucket and exports its name.
4+
5+
## Prerequisites
6+
7+
- Pulumi CLI (>= v3): https://www.pulumi.com/docs/get-started/install/
8+
- Node.js (>= 14): https://nodejs.org/
9+
- AWS credentials configured (e.g., via `aws configure` or environment variables)
10+
11+
## Getting Started
12+
13+
1. Initialize a new Pulumi project:
14+
15+
```bash
16+
pulumi new aws-typescript
17+
```
18+
19+
Follow the prompts to set your:
20+
- Project name
21+
- Project description
22+
- AWS region (defaults to `us-east-1`)
23+
24+
2. Preview and deploy your infrastructure:
25+
26+
```bash
27+
pulumi preview
28+
pulumi up
29+
```
30+
31+
3. When you're finished, tear down your stack:
32+
33+
```bash
34+
pulumi destroy
35+
pulumi stack rm
36+
```
37+
38+
## Project Layout
39+
40+
- `Pulumi.yaml` — Pulumi project and template metadata
41+
- `index.ts` — Main Pulumi program (creates an S3 bucket)
42+
- `package.json` — Node.js dependencies
43+
- `tsconfig.json` — TypeScript compiler options
44+
45+
## Configuration
46+
47+
| Key | Description | Default |
48+
| ------------- | --------------------------------------- | ----------- |
49+
| `aws:region` | The AWS region to deploy resources into | `us-east-1` |
50+
51+
Use `pulumi config set <key> <value>` to customize configuration.
52+
53+
## Next Steps
54+
55+
- Extend `index.ts` to provision additional resources (e.g., VPCs, Lambda functions, DynamoDB tables).
56+
- Explore [Pulumi AWSX](https://www.pulumi.com/docs/reference/pkg/awsx/) for higher-level AWS components.
57+
- Consult the [Pulumi documentation](https://www.pulumi.com/docs/) for more examples and best practices.
58+
59+
## Getting Help
60+
61+
If you encounter any issues or have suggestions, please open an issue in this repository.

0 commit comments

Comments
 (0)