Skip to content

Commit 90c0148

Browse files
authored
Merge pull request #63 from awslabs/merge-jp5-into-main
Merge jp5v2: unified JP4/JP5/x86 build with ECR deployment
2 parents d1e46b5 + 2595d5d commit 90c0148

26 files changed

Lines changed: 1262 additions & 160 deletions

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build artifacts
2+
*.log
3+
custom-build/
4+
greengrass-build/
5+
.gdk/
6+
src/backend/edgemlsdk/
7+
src/edgemlsdk/extracted-debs/
8+
src/edgemlsdk/cached-debs/
9+
10+
# OS files
11+
.DS_Store
12+
__pycache__/
13+
*.pyc

README.md

Lines changed: 138 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ DDA consists of several key components:
170170
- **Minimum**: 4GB RAM, 20GB storage, x86_64 or ARM64 processor
171171
- **Recommended**: 8GB RAM, 64GB storage, GPU acceleration (optional)
172172
- **Supported Platforms**:
173-
- x86_64 CPU systems
174-
- ARM64 CPU systems
175-
- NVIDIA Jetson devices (Xavier Only with Jetpack 4.X, JP5+ coming soon)
173+
- x86_64 CPU systems (Ubuntu 20.04)
174+
- NVIDIA Jetson devices with JetPack 4.6 (Ubuntu 18.04, aarch64)
175+
- NVIDIA Jetson devices with JetPack 5 (Ubuntu 20.04, aarch64)
176176
- **Supported Operating Systems**:
177-
- X86 Ubuntu 20.04, 22.04, (24.04 coming soon)
178-
- Jetson devices currently Jetpack 4.X
179-
- ARM64 - Ubuntu 18.04-22.04
177+
- x86_64: Ubuntu 20.04, 22.04
178+
- ARM64 JetPack 4.6: Ubuntu 18.04
179+
- ARM64 JetPack 5: Ubuntu 20.04
180180

181181
### Supported Cameras and Sensors
182182

@@ -250,6 +250,59 @@ DDA consists of several key components:
250250
}
251251
```
252252

253+
2. **Create ECR publish policy** (required for large Docker images that exceed the 2 GB Greengrass artifact limit):
254+
- Policy name: `dda-ecr-publish`
255+
- This policy allows the build server to push Docker images to ECR and create Greengrass component versions that pull from ECR at deployment time.
256+
- Replace `[AWS account id]` with your account ID:
257+
```json
258+
{
259+
"Version": "2012-10-17",
260+
"Statement": [
261+
{
262+
"Sid": "ECRAuth",
263+
"Effect": "Allow",
264+
"Action": "ecr:GetAuthorizationToken",
265+
"Resource": "*"
266+
},
267+
{
268+
"Sid": "ECRRepoManage",
269+
"Effect": "Allow",
270+
"Action": [
271+
"ecr:CreateRepository",
272+
"ecr:DescribeRepositories",
273+
"ecr:TagResource"
274+
],
275+
"Resource": "arn:aws:ecr:*:[AWS account id]:repository/dda/*"
276+
},
277+
{
278+
"Sid": "ECRPush",
279+
"Effect": "Allow",
280+
"Action": [
281+
"ecr:BatchCheckLayerAvailability",
282+
"ecr:InitiateLayerUpload",
283+
"ecr:UploadLayerPart",
284+
"ecr:CompleteLayerUpload",
285+
"ecr:PutImage",
286+
"ecr:BatchGetImage",
287+
"ecr:GetDownloadUrlForLayer"
288+
],
289+
"Resource": "arn:aws:ecr:*:[AWS account id]:repository/dda/*"
290+
},
291+
{
292+
"Sid": "GreengrassPublish",
293+
"Effect": "Allow",
294+
"Action": [
295+
"greengrass:CreateComponentVersion",
296+
"greengrass:ListComponentVersions"
297+
],
298+
"Resource": "arn:aws:greengrass:*:[AWS account id]:components:aws.edgeml.dda.*"
299+
}
300+
]
301+
}
302+
```
303+
304+
> **Note**: The JetPack 5 (ARM64) backend Docker image exceeds the Greengrass 2 GB artifact size limit. The build script automatically detects this and pushes images to ECR instead. The edge devices will pull from ECR during component installation, so the device's token exchange role also needs `ecr:GetAuthorizationToken`, `ecr:BatchGetImage`, and `ecr:GetDownloadUrlForLayer` permissions (see edge device policy below).
305+
253306
2. **Create edge device policy**:
254307
- Policy name: `dda-greengrass-policy`
255308
```json
@@ -274,6 +327,16 @@ DDA consists of several key components:
274327
"arn:aws:s3:::*"
275328
]
276329
},
330+
{
331+
"Sid": "ECRPull",
332+
"Effect": "Allow",
333+
"Action": [
334+
"ecr:GetAuthorizationToken",
335+
"ecr:BatchGetImage",
336+
"ecr:GetDownloadUrlForLayer"
337+
],
338+
"Resource": "*"
339+
},
277340
{
278341
"Effect": "Allow",
279342
"Action": [
@@ -301,32 +364,80 @@ DDA consists of several key components:
301364
]
302365
}
303366
```
304-
- Attach S3 permissions for component downloads
305367

306368
3. **Create IAM roles**:
307-
- Build server role: `dda-build-role` (attach `dda-build-policy` + `AmazonSSMManagedInstanceCore`)
369+
- Build server role: `dda-build-role` (attach `dda-build-policy` + `dda-ecr-publish` + `AmazonSSMManagedInstanceCore`)
308370
- Edge device role: `dda-greengrass-role` (attach `dda-greengrass-policy` + `AmazonSSMManagedInstanceCore`)
309371

372+
4. **Update the Greengrass Token Exchange Role** (created automatically during Greengrass provisioning):
373+
374+
The `GreengrassV2TokenExchangeRole` is the role that Greengrass components use at runtime to access AWS services. After provisioning the edge device, add these inline policies to it:
375+
376+
**Inline policy: `ECRPullAccess`** (required for JP5 ECR-based deployments):
377+
```json
378+
{
379+
"Version": "2012-10-17",
380+
"Statement": [
381+
{
382+
"Sid": "ECRPull",
383+
"Effect": "Allow",
384+
"Action": [
385+
"ecr:GetAuthorizationToken",
386+
"ecr:BatchGetImage",
387+
"ecr:GetDownloadUrlForLayer"
388+
],
389+
"Resource": "*"
390+
}
391+
]
392+
}
393+
```
394+
395+
**Inline policy: `GreengrassComponentS3Access`** (required for downloading component artifacts):
396+
```json
397+
{
398+
"Version": "2012-10-17",
399+
"Statement": [
400+
{
401+
"Effect": "Allow",
402+
"Action": [
403+
"s3:GetObject",
404+
"s3:GetObjectVersion"
405+
],
406+
"Resource": [
407+
"arn:aws:s3:::dda-component-*/*"
408+
]
409+
}
410+
]
411+
}
412+
```
413+
414+
> **Note**: The `GreengrassV2TokenExchangeRole` is separate from the `dda-greengrass-role` used for device provisioning. It's created by the Greengrass installer and used by components at runtime.
415+
310416
#### Step 1: Set up Build Environment
311417

312418
1. **Launch EC2 build instance**:
313419

314-
**The EC2 build instance depends on the edge device configuration:**
420+
**The EC2 build instance must match the target edge device architecture:**
315421

316-
**If your edge device is ARM64 (Jetson Xavier, ARM64 systems):**
422+
**If your edge device is ARM64 JetPack 4.6 (Jetson Xavier, L4T r32.x):**
317423
```bash
318-
# Launch Ubuntu 18.04 ARM64, g4dn.2xlarge
424+
# Launch Ubuntu 18.04 ARM64 (e.g., a1.2xlarge or c6g.2xlarge)
425+
# Storage: 512GB, Security: SSH (port 22)
426+
# Attach IAM role: dda-build-role
427+
```
428+
429+
**If your edge device is ARM64 JetPack 5 (Jetson Orin, L4T r35.x):**
430+
```bash
431+
# Launch Ubuntu 20.04 ARM64 (e.g., a1.2xlarge or c6g.2xlarge)
319432
# Storage: 512GB, Security: SSH (port 22)
320433
# Attach IAM role: dda-build-role
321-
# AMI: Find Ubuntu 18.04 in AWS Marketplace → [Ryan to add details]
322434
```
323435

324436
**If your edge device is x86_64 CPU (Intel/AMD systems):**
325437
```bash
326-
# Launch Ubuntu 20.04 x86_64, g4dn.2xlarge
438+
# Launch Ubuntu 20.04 x86_64 (e.g., c5.2xlarge or g4dn.2xlarge)
327439
# Storage: 512GB, Security: SSH (port 22)
328440
# Attach IAM role: dda-build-role
329-
# AMI: Ubuntu 20.04 → [Ryan to add details]
330441
```
331442

332443
2. **Connect and setup**:
@@ -365,9 +476,21 @@ DDA consists of several key components:
365476

366477
2. **Build and publish**:
367478
```bash
368-
./gdk-component-build-and-publish.sh >logfile.log 2>&1 &
479+
# For x86_64 builds (auto-detects architecture):
480+
./gdk-component-build-and-publish.sh > build.log 2>&1 &
481+
482+
# For ARM64 JetPack 4.6 builds:
483+
./gdk-component-build-and-publish.sh aarch64 4 > build.log 2>&1 &
484+
485+
# For ARM64 JetPack 5 builds:
486+
./gdk-component-build-and-publish.sh aarch64 5 > build.log 2>&1 &
487+
488+
# Monitor build progress:
489+
tail -f build.log
369490
```
370491

492+
> **Note**: For JetPack 5 builds, the Docker image exceeds the Greengrass 2 GB artifact limit. The build script automatically pushes to ECR and creates a component that pulls images at install time. Ensure the `dda-ecr-publish` policy is attached to your build role.
493+
371494
#### Step 3: Set up Edge Device
372495

373496
1. **For testing only. For real-world deployments: Continue from step 2 when using a Jetson or similar edge device.**:

0 commit comments

Comments
 (0)