Skip to content

Commit e1141e5

Browse files
author
iru
authored
feature: organizational use-case (#77)
1 parent bda9098 commit e1141e5

17 files changed

+894
-339
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
packaged-template.yaml
22
*.zip
33
.idea/
4-
.DS_Store
4+
.DS_Store
5+
6+
.envrc

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: format
5+
pass_filenames: false
6+
name: lint
7+
entry: make -C templates_apprunner lint && make -C templates_ecs lint
8+
language: system

CONTRIBUTE.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
## Contribute
3+
4+
### Release
5+
6+
Templates are [uploaded on the CI release cycle](https://github.com/sysdiglabs/aws-cloudvision-templates/blob/main/.github/workflows/release.yaml#L63) to `cf-templates-cloudvision-ci` on Sysdig `draios-demo` account.
7+
8+
Leading to the latest entry-point, which will be used on the Sysdig Secure > Getting Started > AWS Cloudformation
9+
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/master/entry-point.yaml`
10+
11+
12+
### Pull Request
13+
14+
When the PR is drafted, a new template will be available for testing:
15+
- For ECS
16+
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/pr/<PR_NAME>/entry-point.yaml`
17+
- For AppRunner
18+
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/pr/<PR_NAME>/entry-point.yaml`
19+
20+
21+
### Testing
22+
23+
see [Makefile](templates_ecs/Makefile)
24+
25+
#### Validation
26+
27+
ECS:
28+
29+
```bash
30+
$ aws cloudformation validate-template --template-body file://./templates_ecs/CloudVision.yaml
31+
```
32+
33+
AppRunner:
34+
35+
```bash
36+
$ aws cloudformation validate-template --template-body file://./templates_apprunner/SecureForCloudAppRunner.yaml
37+
```
38+
39+
#### Launch Template
40+
41+
ECS full cycle:
42+
43+
```
44+
-- test
45+
$ aws cloudformation delete-stack --stack-name test ; \
46+
sleep 10 ; \
47+
aws cloudformation deploy --template-file templates_ecs/CloudVision.yaml --stack-name test ; \
48+
aws cloudformation describe-stack-events --stack-name test
49+
```
50+
51+
AppRunner full cycle:
52+
53+
```
54+
-- test
55+
$ aws cloudformation delete-stack --stack-name test ; \
56+
sleep 10 ; \
57+
aws cloudformation deploy --template-file templates_apprunner/SecureForCloudAppRunner.yaml --stack-name test ; \
58+
aws cloudformation describe-stack-events --stack-name test
59+
```
60+
61+
#### Test Template wizard (UI)
62+
```
63+
Aws console > cloudformation > create new stack (template, upload template: select ./templates/Cloudvision.yaml)
64+
```
65+
- note: this will upload the template into an s3 bucket, remember to delete it afterwards
66+
67+
68+
#### Cleanup
69+
70+
Delete stack to clean test environment. [CFT limitation does not allow to automatically delete non-empty S3 bucket](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html), so Stack deletion will fail when you request it. Delete S3 bucket manually and relaunch deletion for a full cleanup.
71+

DecissionRecord.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Decision Record
2+
3+
## 2022.05.19 - helm chart deployment
4+
5+
Analysed possible ways of deploying things into k8s through cloudformation.
6+
Not official but aws-quickstart team offers cloudformation [AWSQS::Kubernetes::Helm](https://github.com/aws-quickstart/quickstart-helm-resource-provider/blob/main/README.md) cloudformation resource.
7+
8+
Resolution: not implemented due to client not needing cloudformation, due to using Spinnaker for Helm deployments.
9+
10+
11+
## 2022.05.13 - organizational/multi-account deployment method
12+
13+
https://github.com/sysdiglabs/aws-templates-secure-for-cloud/pull/77
14+
15+
client needs to deploy things on different levels of accounts
16+
1. management account, requires the creation of a SysdiRole to be able to get organizational cloudtrail data (+s3,sns)
17+
2. all member accounts, require the creation of a SysdigAgentlessRole for benchmark
18+
3. sysdig workload (ecs,apprunner or eks) must be deployed on a selected member account.
19+
20+
Each requirement is separated on its own `Stack` and put all together on a `Stackset`
21+
We can make use the [`AWS::CloudFormation::StackSet` `StackInstancesGroup.DeploymentTargets`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-stackset-stackinstances.html#cfn-cloudformation-stackset-stackinstances-deploymenttargets)
22+
attribute to configure where (org unit or account) to deploy what.
23+
24+
Resolution: none of this is developed yet, because client did not need cloudformation in the end we just delivered a use-case.
25+
26+
27+
## 2022.05.13 - organizational/manual sysdig pre-setup - bash scripts
28+
29+
https://github.com/sysdiglabs/aws-templates-secure-for-cloud/pull/77
30+
31+
for Compliance feature, on self-baked use-cases (which are not launched from the Sysdig Onboarding page)
32+
a pre-setup must be made on Sysdig Secure backend for cloud-account(s) and compliance task provisioning.
33+
34+
a setup guide is given to the client to execute manually (1. sysdig provisioning > 2. aws provisioning > 3. validation)
35+
Options to automatize this I researched are
36+
- https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-awsutilities-commandrunner
37+
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html
38+
39+
Think these options would only complicate things (bash script maintenance and troubleshooting), not worthy automatizing.
40+
41+
Resolution: we will provide a utility script to handle this from outside cloudformation templates.
42+
43+

README.md

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,46 @@
1-
# Sysdig CloudVision for AWS
1+
# Sysdig Secure for Cloud in AWS - Cloudformation Templates
22

3-
This repository contains the CloudFormation templates to deploy the Sysdig
4-
CloudVision suite in an AWS Account using ECS or AppRunner.
3+
This repository contains the CloudFormation templates to deploy [Sysdig Secure for Cloud](https://docs.sysdig.com/en/docs/sysdig-secure/sysdig-secure-for-cloud/)
4+
suite.
55

6-
**[Deploy ECS latest version!](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/latest/entry-point.yaml)**
6+
## UseCases
77

8-
**[Deploy AppRunner latest version!](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/latest/entry-point.yaml)**
8+
If you're unsure about what/how to use this module, please fill the [questionnaire](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/blob/master/use-cases/_questionnaire.md) report as an issue and let us know your context, we will be happy to help and improve our module.
99

10-
## Contribute
10+
### Single-Account
1111

12+
Deploy the latest versions using one of the workloads that most suit you:
1213

13-
### Release
14+
#### ECS-based workload
1415

15-
Templates are [uploaded on the CI release cycle](https://github.com/sysdiglabs/aws-cloudvision-templates/blob/main/.github/workflows/release.yaml#L63) to `cf-templates-cloudvision-ci` on Sysdig `draios-demo` account.
16+
[Template for ECS workload](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/latest/entry-point.yaml)
17+
18+
![single-account diagram](https://raw.githubusercontent.com/sysdiglabs/terraform-aws-secure-for-cloud/master/examples/single-account-ecs/diagram-single.png)
1619

17-
Leading to the latest entry-point, which will be used on the Sysdig Secure > Getting Started > AWS Cloudformation
18-
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/master/entry-point.yaml`
1920

21+
#### AppRunner-based workload
2022

21-
### Pull Request
23+
Less resource-demanding and economic deployment (ECS requires VPCs and Gateways), but Apprunner is not available on all regions yet
2224

23-
When the PR is drafted, a new template will be available for testing:
24-
- For ECS
25-
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/pr/<PR_NAME>/entry-point.yaml`
26-
- For AppRunner
27-
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/pr/<PR_NAME>/entry-point.yaml`
25+
[Template for AppRunner workload](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/latest/entry-point.yaml)
2826

27+
![single-account diagram on apprunner](https://raw.githubusercontent.com/sysdiglabs/terraform-aws-secure-for-cloud/master/examples/single-account-apprunner/diagram-single.png)
2928

30-
### Testing
3129

32-
see [Makefile](templates_ecs/Makefile)
30+
If needed, we also have an <a href="https://github.com/sysdiglabs/terraform-aws-secure-for-cloud">Sysdig Secure for Cloud Terraform version</a>
3331

34-
#### Validation
3532

36-
ECS:
33+
## Organizational
3734

38-
```bash
39-
$ aws cloudformation validate-template --template-body file://./templates_ecs/CloudVision.yaml
40-
```
35+
No official templates available yet.
4136

42-
AppRunner:
37+
Find some [organizational use-case](./use_cases/org-k8s) as reference and contact us for support.
4338

44-
```bash
45-
$ aws cloudformation validate-template --template-body file://./templates_apprunner/SecureForCloudAppRunner.yaml
46-
```
39+
---
40+
## Authors
4741

48-
#### Launch Template
42+
Module is maintained and supported by [Sysdig](https://sysdig.com).
4943

50-
ECS full cycle:
51-
52-
```
53-
-- test
54-
$ aws cloudformation delete-stack --stack-name test ; \
55-
sleep 10 ; \
56-
aws cloudformation deploy --template-file templates_ecs/CloudVision.yaml --stack-name test ; \
57-
aws cloudformation describe-stack-events --stack-name test
58-
```
59-
60-
AppRunner full cycle:
61-
62-
```
63-
-- test
64-
$ aws cloudformation delete-stack --stack-name test ; \
65-
sleep 10 ; \
66-
aws cloudformation deploy --template-file templates_apprunner/SecureForCloudAppRunner.yaml --stack-name test ; \
67-
aws cloudformation describe-stack-events --stack-name test
68-
```
69-
70-
#### Test Template wizard (UI)
71-
```
72-
Aws console > cloudformation > create new stack (template, upload template: select ./templates/Cloudvision.yaml)
73-
```
74-
- note: this will upload the template into an s3 bucket, remember to delete it afterwards
75-
76-
77-
#### Cleanup
78-
79-
Delete stack to clean test environment. [CFT limitation does not allow to automatically delete non-empty S3 bucket](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html), so Stack deletion will fail when you request it. Delete S3 bucket manually and relaunch deletion for a full cleanup.
44+
## License
8045

46+
Apache 2 Licensed. See LICENSE for full details.

0 commit comments

Comments
 (0)