@hiiretail/gcp-infra-cli 0.66.2 → 0.67.2
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.
|
@@ -2,17 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
## Google cloud operations costs
|
|
4
4
|
|
|
5
|
+
### Assumptions
|
|
6
|
+
|
|
5
7
|
<!--
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
Explain what assumption you've made as part of your price estimates.
|
|
9
|
+
For example, number of messages per second, size of stored data,
|
|
10
|
+
number of connected clients etc.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
### Calculations
|
|
14
|
+
|
|
15
|
+
<!--
|
|
16
|
+
Share a link to the Google Price Calculator with your calculations.
|
|
17
|
+
|
|
18
|
+
* Include all components used in your C4 diagrams
|
|
19
|
+
* Present calculations with enough details to understand cost drivers.
|
|
20
|
+
* Presented a tiered table and show the cost for different volumes
|
|
21
|
+
* Include the cost for data in the data mesh
|
|
22
|
+
|
|
23
|
+
Google Price Calculator hints
|
|
24
|
+
|
|
25
|
+
* Use "GKE Node Pool" to calculate cost of Cloud Run for Anthos
|
|
26
|
+
* Always calculate with high availability for Cloud SQL
|
|
27
|
+
* Only include network egress if your system is egress-heavy. It should
|
|
28
|
+
for example be included in external events, but not for scan & go
|
|
9
29
|
-->
|
|
10
30
|
|
|
11
31
|
## High-level cost drivers
|
|
12
32
|
|
|
13
33
|
<!--
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
How would you sell this service to customers? What is the billable metrics of
|
|
35
|
+
this service? There's two types of metrics we want to capture
|
|
36
|
+
|
|
37
|
+
* Seat based - for example number of clients or users
|
|
38
|
+
* Usage based - for example number of price updates per month
|
|
18
39
|
-->
|
|
@@ -25,6 +25,65 @@ module.exports = class extends BaseGenerator {
|
|
|
25
25
|
message: 'Please provide the prefix for the bucket name',
|
|
26
26
|
validate: required,
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
type: 'list',
|
|
30
|
+
name: 'lifecycleRules',
|
|
31
|
+
message: 'Do you want to set up lifecycle rules for the bucket?',
|
|
32
|
+
default: 'false',
|
|
33
|
+
choices: ['true', 'false'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
37
|
+
type: 'list',
|
|
38
|
+
name: 'action',
|
|
39
|
+
message: 'Select the action of this Lifecycle Rule',
|
|
40
|
+
default: 'Delete',
|
|
41
|
+
choices: ['Delete', 'SetStorageClass'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
when: (response) => response.lifecycleRules === 'true' && response.action === 'SetStorageClass',
|
|
45
|
+
type: 'list',
|
|
46
|
+
name: 'storageClass',
|
|
47
|
+
message: 'Select the Storage Class for objects in the bucket',
|
|
48
|
+
default: 'STANDARD',
|
|
49
|
+
choices: ['STANDARD', 'MULTI_REGIONAL', 'REGIONAL', 'NEARLINE', 'COLDLINE', 'ARCHIVE'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
53
|
+
type: 'input',
|
|
54
|
+
name: 'age',
|
|
55
|
+
message: 'Minimum age of an object in days to satisfy the condition. Use null to not set the value',
|
|
56
|
+
validate: required,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
60
|
+
type: 'input',
|
|
61
|
+
name: 'createdBefore',
|
|
62
|
+
message: 'A date in format YYYY-MM-DD. This condition is satisfied when an object is created before midnight of the specified date in UTC. Use null to not set the value',
|
|
63
|
+
validate: required,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
67
|
+
type: 'list',
|
|
68
|
+
name: 'withState',
|
|
69
|
+
message: 'Match to live and/or archived objects. Unversioned buckets have only live objects. Use null to not set the value',
|
|
70
|
+
default: 'LIVE',
|
|
71
|
+
choices: ['LIVE', 'ARCHIVED', 'ANY', 'null'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
75
|
+
type: 'input',
|
|
76
|
+
name: 'matchesStorageClass',
|
|
77
|
+
message: 'Specify comma delimited string of Storage Class of objects to satisfy the condition. Supported values: STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, DURABLE_REDUCED_AVAILABILITY. Use null to not set the value',
|
|
78
|
+
validate: required,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
when: (response) => response.lifecycleRules === 'true',
|
|
82
|
+
type: 'input',
|
|
83
|
+
name: 'numNewerVersions',
|
|
84
|
+
message: 'Relevant only for versioned objects. The number of newer versions of an object to satisfy the condition. Use null to not set the value',
|
|
85
|
+
validate: required,
|
|
86
|
+
},
|
|
28
87
|
];
|
|
29
88
|
|
|
30
89
|
return this.prompt(prompts).then((props) => {
|
|
@@ -36,6 +95,15 @@ module.exports = class extends BaseGenerator {
|
|
|
36
95
|
const {
|
|
37
96
|
bucketName,
|
|
38
97
|
prefix,
|
|
98
|
+
lifecycleRules,
|
|
99
|
+
versioning,
|
|
100
|
+
action,
|
|
101
|
+
storageClass,
|
|
102
|
+
age,
|
|
103
|
+
createdBefore,
|
|
104
|
+
withState,
|
|
105
|
+
matchesStorageClass,
|
|
106
|
+
numNewerVersions,
|
|
39
107
|
} = this.answers;
|
|
40
108
|
|
|
41
109
|
['prod', 'staging'].forEach((env) => {
|
|
@@ -47,6 +115,15 @@ module.exports = class extends BaseGenerator {
|
|
|
47
115
|
env,
|
|
48
116
|
bucketName,
|
|
49
117
|
prefix,
|
|
118
|
+
lifecycleRules,
|
|
119
|
+
versioning,
|
|
120
|
+
action,
|
|
121
|
+
storageClass,
|
|
122
|
+
age,
|
|
123
|
+
createdBefore,
|
|
124
|
+
withState,
|
|
125
|
+
matchesStorageClass,
|
|
126
|
+
numNewerVersions,
|
|
50
127
|
},
|
|
51
128
|
);
|
|
52
129
|
});
|
|
@@ -25,4 +25,23 @@ locals {
|
|
|
25
25
|
"<%-bucketName%>" = <%-versioning%>
|
|
26
26
|
}
|
|
27
27
|
set_viewer_roles = true
|
|
28
|
+
|
|
29
|
+
<% if (lifecycleRules == 'true') { %>
|
|
30
|
+
lifecycle_rules = [{
|
|
31
|
+
action = {
|
|
32
|
+
type = "<%-action%>" <% if (action == 'SetStorageClass') { %>
|
|
33
|
+
storage_class = "<%-storageClass%>" <% } else { %>
|
|
34
|
+
storage_class = null <% } %>
|
|
35
|
+
}
|
|
36
|
+
condition = {
|
|
37
|
+
age = <%-age%> <% if (createdBefore != 'null') { %>
|
|
38
|
+
created_before = "<%-createdBefore%>" <% } else { %>
|
|
39
|
+
created_before = null <% } %> <% if (withState != 'null') { %>
|
|
40
|
+
with_state = "<%-withState%>" <% } else { %>
|
|
41
|
+
with_state = null <% } %> <% if (matchesStorageClass != 'null') { %>
|
|
42
|
+
matches_storage_class = "<%-matchesStorageClass%>" <% } else { %>
|
|
43
|
+
matches_storage_class = null <% } %>
|
|
44
|
+
num_newer_versions = <%-numNewerVersions%>
|
|
45
|
+
}
|
|
46
|
+
}] <% } %>
|
|
28
47
|
}
|