dcl-ops-lib 8.3.3 → 9.1.0
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.
- package/acceptBastion.js +3 -12
- package/acceptDb.js +6 -15
- package/accessTheInternet.js +23 -34
- package/alb.js +7 -16
- package/buildStatic.js +1 -2
- package/cloudflare.js +47 -57
- package/createFargateTask.d.ts +3 -2
- package/createFargateTask.js +233 -252
- package/createImageFromContext.js +6 -2
- package/createSQSTriggeredFargateTask.d.ts +63 -0
- package/createSQSTriggeredFargateTask.js +110 -0
- package/createScheduledFargateTask.d.ts +75 -0
- package/createScheduledFargateTask.js +108 -0
- package/exposePublicService.js +74 -85
- package/fargateHelpers.d.ts +220 -0
- package/fargateHelpers.js +178 -0
- package/getAmi.js +14 -25
- package/getImageRegistryAndCredentials.js +3 -12
- package/index.d.ts +32 -0
- package/index.js +52 -0
- package/lambda.js +124 -132
- package/package.json +13 -9
- package/prometheus.js +6 -15
- package/scheduledTaskBase.d.ts +142 -0
- package/scheduledTaskBase.js +146 -0
- package/slack.d.ts +4 -0
- package/slack.js +21 -0
- package/utils.js +1 -1
- package/values.js +12 -23
- package/vpc.js +7 -18
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
3
|
+
/**
|
|
4
|
+
* Team type used by all Fargate-related functions for ownership tagging
|
|
5
|
+
*/
|
|
6
|
+
export type Team = "dapps" | "platform" | "data" | "marketing" | "infra";
|
|
7
|
+
/**
|
|
8
|
+
* Prometheus metrics configuration
|
|
9
|
+
*/
|
|
10
|
+
export type MetricsConfig = {
|
|
11
|
+
/**
|
|
12
|
+
* Port where metrics are exposed
|
|
13
|
+
*/
|
|
14
|
+
port: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Path to the metrics endpoint (default: "/metrics")
|
|
17
|
+
*/
|
|
18
|
+
path?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Job name for Prometheus (default: task/service name)
|
|
21
|
+
*/
|
|
22
|
+
jobName?: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Default CPU units for Fargate tasks (256 = 0.25 vCPU)
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_CPU = 256;
|
|
28
|
+
/**
|
|
29
|
+
* Default memory in MB for Fargate tasks
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_MEMORY = 512;
|
|
32
|
+
/**
|
|
33
|
+
* Default CloudWatch log retention in days
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_LOG_RETENTION_DAYS = 60;
|
|
36
|
+
/**
|
|
37
|
+
* Default desired count for ECS services
|
|
38
|
+
*/
|
|
39
|
+
export declare const DEFAULT_DESIRED_COUNT = 1;
|
|
40
|
+
/**
|
|
41
|
+
* Creates standard resource tags for Fargate resources
|
|
42
|
+
*
|
|
43
|
+
* @param serviceName The name of the service/task
|
|
44
|
+
* @param team Team that owns this resource
|
|
45
|
+
* @param additionalTags Optional additional tags to merge
|
|
46
|
+
* @returns Record of tags
|
|
47
|
+
*/
|
|
48
|
+
export declare function createResourceTags(serviceName: string, team: Team, additionalTags?: Record<string, string>): Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a CloudWatch Log Group with consistent settings
|
|
51
|
+
*
|
|
52
|
+
* @param name The name for the log group (will be stack-scoped)
|
|
53
|
+
* @param team Team that owns this resource
|
|
54
|
+
* @param retentionInDays Log retention in days (default: 60)
|
|
55
|
+
* @returns The created CloudWatch Log Group
|
|
56
|
+
*/
|
|
57
|
+
export declare function createLogGroup(name: string, team: Team, retentionInDays?: number): aws.cloudwatch.LogGroup;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a security group for a Fargate task/service with standard tags
|
|
60
|
+
*
|
|
61
|
+
* @param name Resource name for the security group
|
|
62
|
+
* @param vpcId The VPC ID where the security group will be created
|
|
63
|
+
* @param serviceName The name of the service (for tagging)
|
|
64
|
+
* @param team Team that owns this resource
|
|
65
|
+
* @returns The created EC2 Security Group
|
|
66
|
+
*/
|
|
67
|
+
export declare function createTaskSecurityGroup(name: string, vpcId: pulumi.Input<string>, serviceName: string, team: Team): aws.ec2.SecurityGroup;
|
|
68
|
+
/**
|
|
69
|
+
* Configures docker labels for Prometheus metrics discovery
|
|
70
|
+
*
|
|
71
|
+
* @param taskName The name of the task/service
|
|
72
|
+
* @param metrics Metrics configuration
|
|
73
|
+
* @returns Docker labels, port mappings, and the parsed metrics port
|
|
74
|
+
*/
|
|
75
|
+
export declare function configurePrometheusMetrics(taskName: string, metrics: MetricsConfig): {
|
|
76
|
+
dockerLabels: Record<string, string>;
|
|
77
|
+
portMappings: aws.ecs.PortMapping[];
|
|
78
|
+
metricsPort: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Creates security group rules to allow Prometheus metrics scraping
|
|
82
|
+
*
|
|
83
|
+
* @param resourcePrefix Prefix for resource names
|
|
84
|
+
* @param securityGroup The security group to add rules to
|
|
85
|
+
* @param vpcCidrBlock The VPC CIDR block for ingress rules
|
|
86
|
+
* @param metricsPort The port where metrics are exposed
|
|
87
|
+
* @param taskName The name of the task/service
|
|
88
|
+
*/
|
|
89
|
+
export declare function setupPrometheusSecurityRules(resourcePrefix: string, securityGroup: aws.ec2.SecurityGroup, vpcCidrBlock: string, metricsPort: number, taskName: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Options for building a container definition
|
|
92
|
+
*/
|
|
93
|
+
export type ContainerDefinitionOptions = {
|
|
94
|
+
/**
|
|
95
|
+
* Container name
|
|
96
|
+
*/
|
|
97
|
+
name: string;
|
|
98
|
+
/**
|
|
99
|
+
* Docker image to run
|
|
100
|
+
*/
|
|
101
|
+
image: string | Promise<string> | pulumi.OutputInstance<string>;
|
|
102
|
+
/**
|
|
103
|
+
* CPU units for this container
|
|
104
|
+
*/
|
|
105
|
+
cpu: number;
|
|
106
|
+
/**
|
|
107
|
+
* Memory reservation in MB
|
|
108
|
+
*/
|
|
109
|
+
memory: number;
|
|
110
|
+
/**
|
|
111
|
+
* Environment variables
|
|
112
|
+
*/
|
|
113
|
+
environment?: {
|
|
114
|
+
name: string;
|
|
115
|
+
value: pulumi.Input<string>;
|
|
116
|
+
}[];
|
|
117
|
+
/**
|
|
118
|
+
* Secrets from SSM/Secrets Manager
|
|
119
|
+
*/
|
|
120
|
+
secrets?: aws.ecs.Secret[];
|
|
121
|
+
/**
|
|
122
|
+
* Override command
|
|
123
|
+
*/
|
|
124
|
+
command?: string[];
|
|
125
|
+
/**
|
|
126
|
+
* Override entry point
|
|
127
|
+
*/
|
|
128
|
+
entryPoint?: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Port mappings
|
|
131
|
+
*/
|
|
132
|
+
portMappings?: aws.ecs.PortMapping[];
|
|
133
|
+
/**
|
|
134
|
+
* Docker labels (e.g., for Prometheus)
|
|
135
|
+
*/
|
|
136
|
+
dockerLabels?: Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* Mount points for volumes
|
|
139
|
+
*/
|
|
140
|
+
mountPoints?: aws.ecs.MountPoint[];
|
|
141
|
+
/**
|
|
142
|
+
* Repository credentials for private registries
|
|
143
|
+
*/
|
|
144
|
+
repositoryCredentials?: aws.ecs.RepositoryCredentials;
|
|
145
|
+
/**
|
|
146
|
+
* Log configuration
|
|
147
|
+
*/
|
|
148
|
+
logConfiguration: aws.ecs.LogConfiguration;
|
|
149
|
+
/**
|
|
150
|
+
* Whether this container is essential (default: true)
|
|
151
|
+
*/
|
|
152
|
+
essential?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Container health check
|
|
155
|
+
*/
|
|
156
|
+
healthCheck?: aws.ecs.HealthCheck;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Builds a container definition object for ECS task definitions
|
|
160
|
+
*
|
|
161
|
+
* @param options Container definition options
|
|
162
|
+
* @returns Container definition object
|
|
163
|
+
*/
|
|
164
|
+
export declare function buildContainerDefinition(options: ContainerDefinitionOptions): aws.ecs.ContainerDefinition;
|
|
165
|
+
/**
|
|
166
|
+
* Options for creating a Fargate task definition
|
|
167
|
+
*/
|
|
168
|
+
export type FargateTaskDefinitionOptions = {
|
|
169
|
+
/**
|
|
170
|
+
* Name for the task definition
|
|
171
|
+
*/
|
|
172
|
+
name: string;
|
|
173
|
+
/**
|
|
174
|
+
* Execution role ARN (optional for some use cases)
|
|
175
|
+
*/
|
|
176
|
+
executionRoleArn?: pulumi.Input<string>;
|
|
177
|
+
/**
|
|
178
|
+
* Task role ARN (optional for some use cases)
|
|
179
|
+
*/
|
|
180
|
+
taskRoleArn?: pulumi.Input<string>;
|
|
181
|
+
/**
|
|
182
|
+
* JSON-stringified container definitions
|
|
183
|
+
*/
|
|
184
|
+
containerDefinitions: pulumi.Input<string>;
|
|
185
|
+
/**
|
|
186
|
+
* Team that owns this resource
|
|
187
|
+
*/
|
|
188
|
+
team: Team;
|
|
189
|
+
/**
|
|
190
|
+
* CPU units for the task
|
|
191
|
+
*/
|
|
192
|
+
cpu: pulumi.Input<number>;
|
|
193
|
+
/**
|
|
194
|
+
* Memory in MB for the task
|
|
195
|
+
*/
|
|
196
|
+
memory: pulumi.Input<number>;
|
|
197
|
+
/**
|
|
198
|
+
* Ephemeral storage in GB (20-200)
|
|
199
|
+
*/
|
|
200
|
+
ephemeralStorageInGB?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Runtime platform configuration (e.g., for ARM64)
|
|
203
|
+
*/
|
|
204
|
+
runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
|
|
205
|
+
/**
|
|
206
|
+
* Volumes to attach
|
|
207
|
+
*/
|
|
208
|
+
volumes?: pulumi.Input<aws.types.input.ecs.TaskDefinitionVolume[]>;
|
|
209
|
+
/**
|
|
210
|
+
* Resources to depend on
|
|
211
|
+
*/
|
|
212
|
+
dependsOn?: pulumi.Resource[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Creates a Fargate task definition with standard settings
|
|
216
|
+
*
|
|
217
|
+
* @param options Task definition options
|
|
218
|
+
* @returns The created ECS Task Definition
|
|
219
|
+
*/
|
|
220
|
+
export declare function createFargateTaskDefinition(options: FargateTaskDefinitionOptions): aws.ecs.TaskDefinition;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFargateTaskDefinition = exports.buildContainerDefinition = exports.setupPrometheusSecurityRules = exports.configurePrometheusMetrics = exports.createTaskSecurityGroup = exports.createLogGroup = exports.createResourceTags = exports.DEFAULT_DESIRED_COUNT = exports.DEFAULT_LOG_RETENTION_DAYS = exports.DEFAULT_MEMORY = exports.DEFAULT_CPU = void 0;
|
|
4
|
+
const aws = require("@pulumi/aws");
|
|
5
|
+
const pulumi = require("@pulumi/pulumi");
|
|
6
|
+
const stack_1 = require("./stack");
|
|
7
|
+
const prometheus_1 = require("./prometheus");
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Default Constants
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Default CPU units for Fargate tasks (256 = 0.25 vCPU)
|
|
13
|
+
*/
|
|
14
|
+
exports.DEFAULT_CPU = 256;
|
|
15
|
+
/**
|
|
16
|
+
* Default memory in MB for Fargate tasks
|
|
17
|
+
*/
|
|
18
|
+
exports.DEFAULT_MEMORY = 512;
|
|
19
|
+
/**
|
|
20
|
+
* Default CloudWatch log retention in days
|
|
21
|
+
*/
|
|
22
|
+
exports.DEFAULT_LOG_RETENTION_DAYS = 60;
|
|
23
|
+
/**
|
|
24
|
+
* Default desired count for ECS services
|
|
25
|
+
*/
|
|
26
|
+
exports.DEFAULT_DESIRED_COUNT = 1;
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// Helper Functions
|
|
29
|
+
// ============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* Creates standard resource tags for Fargate resources
|
|
32
|
+
*
|
|
33
|
+
* @param serviceName The name of the service/task
|
|
34
|
+
* @param team Team that owns this resource
|
|
35
|
+
* @param additionalTags Optional additional tags to merge
|
|
36
|
+
* @returns Record of tags
|
|
37
|
+
*/
|
|
38
|
+
function createResourceTags(serviceName, team, additionalTags) {
|
|
39
|
+
return {
|
|
40
|
+
ServiceName: serviceName,
|
|
41
|
+
Team: team,
|
|
42
|
+
...additionalTags,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.createResourceTags = createResourceTags;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a CloudWatch Log Group with consistent settings
|
|
48
|
+
*
|
|
49
|
+
* @param name The name for the log group (will be stack-scoped)
|
|
50
|
+
* @param team Team that owns this resource
|
|
51
|
+
* @param retentionInDays Log retention in days (default: 60)
|
|
52
|
+
* @returns The created CloudWatch Log Group
|
|
53
|
+
*/
|
|
54
|
+
function createLogGroup(name, team, retentionInDays = 60) {
|
|
55
|
+
return new aws.cloudwatch.LogGroup((0, stack_1.getStackScopedName)(name), {
|
|
56
|
+
name: (0, stack_1.getStackScopedName)(name),
|
|
57
|
+
retentionInDays,
|
|
58
|
+
tags: { ServiceName: name, Team: team },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.createLogGroup = createLogGroup;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a security group for a Fargate task/service with standard tags
|
|
64
|
+
*
|
|
65
|
+
* @param name Resource name for the security group
|
|
66
|
+
* @param vpcId The VPC ID where the security group will be created
|
|
67
|
+
* @param serviceName The name of the service (for tagging)
|
|
68
|
+
* @param team Team that owns this resource
|
|
69
|
+
* @returns The created EC2 Security Group
|
|
70
|
+
*/
|
|
71
|
+
function createTaskSecurityGroup(name, vpcId, serviceName, team) {
|
|
72
|
+
return new aws.ec2.SecurityGroup(name, {
|
|
73
|
+
vpcId,
|
|
74
|
+
tags: { ServiceName: serviceName, Team: team },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.createTaskSecurityGroup = createTaskSecurityGroup;
|
|
78
|
+
/**
|
|
79
|
+
* Configures docker labels for Prometheus metrics discovery
|
|
80
|
+
*
|
|
81
|
+
* @param taskName The name of the task/service
|
|
82
|
+
* @param metrics Metrics configuration
|
|
83
|
+
* @returns Docker labels, port mappings, and the parsed metrics port
|
|
84
|
+
*/
|
|
85
|
+
function configurePrometheusMetrics(taskName, metrics) {
|
|
86
|
+
const metricsPort = typeof metrics.port === "string" ? parseInt(metrics.port) : metrics.port;
|
|
87
|
+
const dockerLabels = {
|
|
88
|
+
ECS_PROMETHEUS_EXPORTER_PORT: "" + metricsPort,
|
|
89
|
+
ECS_PROMETHEUS_METRICS_PATH: metrics.path || "/metrics",
|
|
90
|
+
ECS_PROMETHEUS_JOB_NAME: metrics.jobName || taskName,
|
|
91
|
+
};
|
|
92
|
+
const portMappings = [
|
|
93
|
+
{
|
|
94
|
+
containerPort: metricsPort,
|
|
95
|
+
hostPort: metricsPort,
|
|
96
|
+
protocol: "tcp",
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
return { dockerLabels, portMappings, metricsPort };
|
|
100
|
+
}
|
|
101
|
+
exports.configurePrometheusMetrics = configurePrometheusMetrics;
|
|
102
|
+
/**
|
|
103
|
+
* Creates security group rules to allow Prometheus metrics scraping
|
|
104
|
+
*
|
|
105
|
+
* @param resourcePrefix Prefix for resource names
|
|
106
|
+
* @param securityGroup The security group to add rules to
|
|
107
|
+
* @param vpcCidrBlock The VPC CIDR block for ingress rules
|
|
108
|
+
* @param metricsPort The port where metrics are exposed
|
|
109
|
+
* @param taskName The name of the task/service
|
|
110
|
+
*/
|
|
111
|
+
function setupPrometheusSecurityRules(resourcePrefix, securityGroup, vpcCidrBlock, metricsPort, taskName) {
|
|
112
|
+
// Create security group rule for metrics access from VPC
|
|
113
|
+
new aws.ec2.SecurityGroupRule(`${resourcePrefix}-metrics-${metricsPort}`, {
|
|
114
|
+
type: "ingress",
|
|
115
|
+
fromPort: metricsPort,
|
|
116
|
+
toPort: metricsPort,
|
|
117
|
+
protocol: "tcp",
|
|
118
|
+
cidrBlocks: [vpcCidrBlock],
|
|
119
|
+
securityGroupId: securityGroup.id,
|
|
120
|
+
});
|
|
121
|
+
// Enable Prometheus to access the metrics port
|
|
122
|
+
(0, prometheus_1.makeSecurityGroupAccessibleByPrometheus)(securityGroup, metricsPort, metricsPort, taskName);
|
|
123
|
+
}
|
|
124
|
+
exports.setupPrometheusSecurityRules = setupPrometheusSecurityRules;
|
|
125
|
+
/**
|
|
126
|
+
* Builds a container definition object for ECS task definitions
|
|
127
|
+
*
|
|
128
|
+
* @param options Container definition options
|
|
129
|
+
* @returns Container definition object
|
|
130
|
+
*/
|
|
131
|
+
function buildContainerDefinition(options) {
|
|
132
|
+
const { name, image, cpu, memory, environment = [], secrets = [], command, entryPoint, portMappings = [], dockerLabels = {}, mountPoints = [], repositoryCredentials, logConfiguration, essential = true, healthCheck, } = options;
|
|
133
|
+
return {
|
|
134
|
+
name,
|
|
135
|
+
image,
|
|
136
|
+
essential,
|
|
137
|
+
environment,
|
|
138
|
+
secrets,
|
|
139
|
+
command,
|
|
140
|
+
entryPoint,
|
|
141
|
+
cpu,
|
|
142
|
+
memoryReservation: memory,
|
|
143
|
+
portMappings,
|
|
144
|
+
dockerLabels,
|
|
145
|
+
mountPoints,
|
|
146
|
+
repositoryCredentials,
|
|
147
|
+
logConfiguration,
|
|
148
|
+
healthCheck,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
exports.buildContainerDefinition = buildContainerDefinition;
|
|
152
|
+
/**
|
|
153
|
+
* Creates a Fargate task definition with standard settings
|
|
154
|
+
*
|
|
155
|
+
* @param options Task definition options
|
|
156
|
+
* @returns The created ECS Task Definition
|
|
157
|
+
*/
|
|
158
|
+
function createFargateTaskDefinition(options) {
|
|
159
|
+
const { name, executionRoleArn, taskRoleArn, containerDefinitions, team, cpu, memory, ephemeralStorageInGB, runtimePlatform, volumes, dependsOn = [], } = options;
|
|
160
|
+
return new aws.ecs.TaskDefinition(`${(0, stack_1.getStackScopedName)(name)}-taskdefinition`, {
|
|
161
|
+
executionRoleArn,
|
|
162
|
+
taskRoleArn,
|
|
163
|
+
tags: createResourceTags(name, team),
|
|
164
|
+
containerDefinitions,
|
|
165
|
+
ephemeralStorage: ephemeralStorageInGB
|
|
166
|
+
? { sizeInGib: ephemeralStorageInGB }
|
|
167
|
+
: undefined,
|
|
168
|
+
cpu: pulumi.output(cpu).apply((c) => c.toString()),
|
|
169
|
+
memory: pulumi.output(memory).apply((m) => m.toString()),
|
|
170
|
+
runtimePlatform,
|
|
171
|
+
requiresCompatibilities: ["FARGATE"],
|
|
172
|
+
networkMode: "awsvpc",
|
|
173
|
+
volumes,
|
|
174
|
+
family: (0, stack_1.getStackScopedName)(name),
|
|
175
|
+
}, { dependsOn });
|
|
176
|
+
}
|
|
177
|
+
exports.createFargateTaskDefinition = createFargateTaskDefinition;
|
|
178
|
+
//# sourceMappingURL=fargateHelpers.js.map
|
package/getAmi.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getAmi = void 0;
|
|
13
4
|
const aws = require("@pulumi/aws");
|
|
@@ -15,22 +6,20 @@ const aws = require("@pulumi/aws");
|
|
|
15
6
|
* @param amiId the ID of the AMI in the Amazon Marketplace
|
|
16
7
|
* @param args.owners the owner of the AMI. Defaults to Amazon owned AMIs
|
|
17
8
|
*/
|
|
18
|
-
function getAmi(amiId, args) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return ami.id;
|
|
33
|
-
});
|
|
9
|
+
async function getAmi(amiId, args) {
|
|
10
|
+
const owners = args && args.owners ? args.owners : ["137112412989"];
|
|
11
|
+
const ami = await aws.ec2.getAmi({
|
|
12
|
+
filters: [
|
|
13
|
+
{
|
|
14
|
+
name: "name",
|
|
15
|
+
values: [amiId],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
mostRecent: true,
|
|
19
|
+
includeDeprecated: true,
|
|
20
|
+
owners,
|
|
21
|
+
}, { async: true });
|
|
22
|
+
return ami.id;
|
|
34
23
|
}
|
|
35
24
|
exports.getAmi = getAmi;
|
|
36
25
|
//# sourceMappingURL=getAmi.js.map
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getImageRegistryAndCredentials = void 0;
|
|
13
4
|
const aws = require("@pulumi/aws");
|
|
14
5
|
function getImageRegistryAndCredentials(repo) {
|
|
15
|
-
return repo.registryId.apply((registryId) =>
|
|
6
|
+
return repo.registryId.apply(async (registryId) => {
|
|
16
7
|
if (!registryId) {
|
|
17
8
|
throw new Error("Expected registry ID to be defined during push");
|
|
18
9
|
}
|
|
19
|
-
const credentials =
|
|
10
|
+
const credentials = await aws.ecr.getCredentials({ registryId: registryId });
|
|
20
11
|
const decodedCredentials = Buffer.from(credentials.authorizationToken, "base64").toString();
|
|
21
12
|
const [username, password] = decodedCredentials.split(":");
|
|
22
13
|
if (!password || !username) {
|
|
@@ -27,7 +18,7 @@ function getImageRegistryAndCredentials(repo) {
|
|
|
27
18
|
username: username,
|
|
28
19
|
password: password,
|
|
29
20
|
};
|
|
30
|
-
})
|
|
21
|
+
});
|
|
31
22
|
}
|
|
32
23
|
exports.getImageRegistryAndCredentials = getImageRegistryAndCredentials;
|
|
33
24
|
//# sourceMappingURL=getImageRegistryAndCredentials.js.map
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from "./acceptAlb";
|
|
2
|
+
export * from "./acceptBastion";
|
|
3
|
+
export * from "./acceptDb";
|
|
4
|
+
export * from "./accessTheInternet";
|
|
5
|
+
export * from "./alb";
|
|
6
|
+
export * from "./buildStatic";
|
|
7
|
+
export * from "./certificate";
|
|
8
|
+
export * from "./cloudflare";
|
|
9
|
+
export * from "./cloudwatchLogs";
|
|
10
|
+
export * from "./createBucketWithUser";
|
|
11
|
+
export * from "./createFargateTask";
|
|
12
|
+
export * from "./createImageFromContext";
|
|
13
|
+
export * from "./createScheduledFargateTask";
|
|
14
|
+
export * from "./createSQSTriggeredFargateTask";
|
|
15
|
+
export * from "./domain";
|
|
16
|
+
export * from "./exposePublicService";
|
|
17
|
+
export * from "./getAmi";
|
|
18
|
+
export * from "./getDomainAndSubdomain";
|
|
19
|
+
export * from "./getImageRegistryAndCredentials";
|
|
20
|
+
export * from "./lambda";
|
|
21
|
+
export * from "./network";
|
|
22
|
+
export * from "./prometheus";
|
|
23
|
+
export * from "./scheduledTaskBase";
|
|
24
|
+
export * from "./secrets";
|
|
25
|
+
export * from "./slack";
|
|
26
|
+
export * from "./stack";
|
|
27
|
+
export * from "./StaticWebsite";
|
|
28
|
+
export * from "./supra";
|
|
29
|
+
export * from "./utils";
|
|
30
|
+
export * from "./values";
|
|
31
|
+
export * from "./vpc";
|
|
32
|
+
export { default as withCache } from "./withCache";
|
package/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Re-export all modules for convenient imports from "dcl-ops-lib"
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.withCache = void 0;
|
|
19
|
+
__exportStar(require("./acceptAlb"), exports);
|
|
20
|
+
__exportStar(require("./acceptBastion"), exports);
|
|
21
|
+
__exportStar(require("./acceptDb"), exports);
|
|
22
|
+
__exportStar(require("./accessTheInternet"), exports);
|
|
23
|
+
__exportStar(require("./alb"), exports);
|
|
24
|
+
__exportStar(require("./buildStatic"), exports);
|
|
25
|
+
__exportStar(require("./certificate"), exports);
|
|
26
|
+
__exportStar(require("./cloudflare"), exports);
|
|
27
|
+
__exportStar(require("./cloudwatchLogs"), exports);
|
|
28
|
+
__exportStar(require("./createBucketWithUser"), exports);
|
|
29
|
+
__exportStar(require("./createFargateTask"), exports);
|
|
30
|
+
__exportStar(require("./createImageFromContext"), exports);
|
|
31
|
+
__exportStar(require("./createScheduledFargateTask"), exports);
|
|
32
|
+
__exportStar(require("./createSQSTriggeredFargateTask"), exports);
|
|
33
|
+
__exportStar(require("./domain"), exports);
|
|
34
|
+
__exportStar(require("./exposePublicService"), exports);
|
|
35
|
+
__exportStar(require("./getAmi"), exports);
|
|
36
|
+
__exportStar(require("./getDomainAndSubdomain"), exports);
|
|
37
|
+
__exportStar(require("./getImageRegistryAndCredentials"), exports);
|
|
38
|
+
__exportStar(require("./lambda"), exports);
|
|
39
|
+
__exportStar(require("./network"), exports);
|
|
40
|
+
__exportStar(require("./prometheus"), exports);
|
|
41
|
+
__exportStar(require("./scheduledTaskBase"), exports);
|
|
42
|
+
__exportStar(require("./secrets"), exports);
|
|
43
|
+
__exportStar(require("./slack"), exports);
|
|
44
|
+
__exportStar(require("./stack"), exports);
|
|
45
|
+
__exportStar(require("./StaticWebsite"), exports);
|
|
46
|
+
__exportStar(require("./supra"), exports);
|
|
47
|
+
__exportStar(require("./utils"), exports);
|
|
48
|
+
__exportStar(require("./values"), exports);
|
|
49
|
+
__exportStar(require("./vpc"), exports);
|
|
50
|
+
var withCache_1 = require("./withCache");
|
|
51
|
+
Object.defineProperty(exports, "withCache", { enumerable: true, get: function () { return withCache_1.default; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|