You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-10Lines changed: 5 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,23 @@
1
1
*Copyright (C) 2021, Axis Communications AB, Lund, Sweden. All Rights Reserved.*
2
2
3
-
<!-- omit in toc -->
4
-
# This repository has been archived, and its content moved to [Axis Developer Documentation](https://developer.axis.com/)
5
-
6
3
# Integration between Axis devices and Amazon Web Services (AWS)
7
4
8
5
## Introduction
9
6
10
-
[AXIS Camera Application Platform (ACAP)](https://www.axis.com/support/developer-support/axis-camera-application-platform) is an open platform that enables developer to build applications that can be installed on Axis network cameras and video encoders.
7
+
The [Axis Developer Documentation](https://developer.axis.com/) serves as a comprehensive resource hub for developers and solution builders aiming to build applications tailored for Axis network-connected devices.
11
8
12
9
[Amazon Web Services (AWS)](https://aws.amazon.com) is a platform in the cloud that provides highly reliable, scalable, low-cost infrastructure to individuals, companies, and governments.
13
10
14
-
This repository focuses on providing examples where we create the integration between the Axis device and Amazon Web Services. If you are interested in camera applications and the different API surfaces an application can use, please visit our related repository [AxisCommunications/acap3-examples](https://github.com/AxisCommunications/acap3-examples/).
15
-
16
-
## Example applications
11
+
This repository focuses on providing code to examples where we create the integration between the Axis device and Amazon Web Services.
17
12
18
-
The repository contains a set of examples, each tailored towards a specific problem. All examples have a README file in its directory which shows overview, example directory structure and step-by-step instructions on how to deploy the AWS infrastructure and how to configure the camera to interact with AWS.
13
+
## Code examples
19
14
20
15
If you find yourself wishing there was another example more relevant to your use case, please don't hesitate to [start a discussion](https://github.com/AxisCommunications/acap-integration-examples-aws/discussions/new) or [open a new issue](https://github.com/AxisCommunications/acap-integration-examples-aws/issues/new/choose).
21
16
22
17
-[images-to-aws-s3](./images-to-aws-s3/)
23
-
- This example covers sending images from a camera to AWS S3
18
+
- This code example covers sending images from a camera to AWS S3
-[Deploy the AWS resources](#deploy-the-aws-resources)
23
-
-[Configure the camera](#configure-the-camera)
24
-
-[Cleanup](#cleanup)
25
-
-[Troubleshooting](#troubleshooting)
26
-
-[No images are sent to AWS S3](#no-images-are-sent-to-aws-s3)
27
-
-[License](#license)
28
-
29
-
## Overview
30
-
31
-
In this example we create an application that sends images from an Axis camera to AWS S3. We start with building and deploying the [AWS Serverless Application Model (AWS SAM)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html), and then continue with configuring the camera.
32
-
33
-

34
-
35
-
The application consists of the following AWS resources.
36
-
37
-
- API Gateway
38
-
- API Gateway Lambda authorizer
39
-
- Access token stored in Secrets Manager
40
-
- Lambda function
41
-
- S3 bucket
42
-
43
-
As the camera is not able to sign requests using [AWS Signature Version 4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) we need to include a Lambda function to handle this step. Rather than sending images directly from the Axis camera to AWS S3 we instead send them to an API Gateway. The API Gateway delegates authorization to a Lambda authorizer that compares the provided access token to an access token stored in Secrets Manager. If the provided access token is deemed valid the API Gateway forwards the request to a Lambda function that proceeds with uploading the provided image to an AWS S3 bucket.
44
-
45
-
## Mentions
46
-
47
-
For more information regarding the relevance of this sample, please see the following articles.
48
-
49
-
-[AWS Machine Learning Blog: Enable scalable, highly accurate, and cost-effective video analytics with Axis Communications and Amazon Rekognition](https://aws.amazon.com/blogs/machine-learning/enable-scalable-highly-accurate-and-cost-effective-video-analytics-with-axis-communications-and-amazon-rekognition/)
50
-
51
-
## Prerequisites
52
-
53
-
- A network camera from Axis Communications (example has been verified to work on a single channel camera with firmware version >=9.80)
- AWS SAM CLI ([install](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html))
10
+
This directory hosts the necessary code to follow the instructions detailed in [Send images to AWS S3](https://developer.axis.com/computer-vision/how-to-guides/send-images-to-aws-s3) on Axis Developer Documentation.
56
11
57
12
## File structure
58
13
@@ -74,125 +29,6 @@ images-to-aws-s3
74
29
└── template.yaml - AWS SAM template describing the AWS resources
75
30
```
76
31
77
-
## Command-line interface
78
-
79
-
To follow the procedures in this example you need a command-line interface or shell to run commands.
80
-
81
-
In some command listings, the commands are described as is, ready to be copied to your command-line interface and executed.
82
-
83
-
<!-- markdownlint-disable MD040 -->
84
-
```
85
-
this is a command
86
-
```
87
-
88
-
In other command listings, commands are preceded by a prompt symbol (`$`) when the output of the command also is of importance.
89
-
90
-
<!-- markdownlint-disable MD040 -->
91
-
```
92
-
$ this is a command
93
-
> This is output
94
-
```
95
-
96
-
Command listings where your input is required are marked using angle brackets (`<` and `>`).
97
-
98
-
```sh
99
-
some-command <your input>
100
-
```
101
-
102
-
For long commands, we use an escape character (`\`) to split a command over multiple lines.
103
-
104
-
On Linux and macOS, use your preferred shell and package manager. On Windows 10, you can [install the Windows Subsystem for Linux](https://docs.microsoft.com/windows/wsl/install) to get a Windows-integrated version of Ubuntu and Bash.
105
-
106
-
## Instructions
107
-
108
-
The instructions are divided into two parts. The first part covers deploying the AWS resources and the second part covers configuring the camera.
109
-
110
-
To start off, make sure to clone the repository and navigate into the example directory.
Let's build and deploy the AWS resources receiving the images sent from an Axis camera. The resources are described in `template.yaml` using AWS SAM.
120
-
121
-
To build and deploy your application for the first time, run the following commands in your shell.
122
-
123
-
```sh
124
-
sam build
125
-
sam deploy --guided
126
-
```
127
-
128
-
The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts.
129
-
130
-
-**Stack Name**: The name of the CloudFormation stack. This should be unique to your account and region, and a good starting point would be `images-to-aws-s3` or something similar.
131
-
-**AWS Region**: The AWS region you want to deploy your app to.
132
-
-**Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
133
-
-**Allow SAM CLI IAM role creation**: This AWS SAM template creates AWS IAM roles required for the AWS Lambda function to access AWS services. By default, these are scoped down to minimum required permissions. Select `Y` to have SAM automatically create the roles.
134
-
-**Save arguments to samconfig.toml**: If set to `Y`, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
135
-
136
-
After a successful deployment navigate to your newly created AWS CloudFormation stack in the AWS Console. The stack will contain three output parameters. One is called `Recipient` and defines the URL of the AWS HTTP API where cameras should send their images. Another is called `AccessToken` and contains the URL to the secret API access token found in AWS Secrets Manager. This API access token authorizes the camera and allows it to send images. Requests to the AWS HTTP API without this access token will be denied access. Both these output parameters will be used in the next chapter where we configure the camera.
137
-
138
-
### Configure the camera
139
-
140
-
Now that the resources in AWS are ready to accept images, let's continue with configuring the camera to send them.
141
-
142
-
Navigate to the camera using your preferred web browser. In the user interface of the camera, select *Settings* -> *System* -> *Events*. In this user interface we'll do all configuration, but first let's get an overview of the available tabs.
143
-
144
-
-**Rules** - Here we'll create a rule that sends images to our AWS S3 bucket
145
-
-**Schedules** - In this sample we'll use a schedule to define *when* an image should be sent. If a schedule doesn't fit your specific use case, you can replace it with any event generated on the camera or even an event generated by any ACAP installed on the camera.
146
-
-**Recipients** - Here we'll define *where* images are sent
147
-
148
-
Let's start with *Recipients*. Select the tab and create a new recipient with the following settings.
149
-
150
-
-**Name**: `AWS S3`
151
-
-**Type**: `HTTPS`
152
-
-**URL**: Back when we deployed the AWS resources using CloudFormation stacks we talked about output parameters. You'll have to get the value of the output parameter named `Recipient` and enter it here.
153
-
154
-
Click the *Save* button.
155
-
156
-
Now let's navigate to the *Schedules* tab. In this sample we'll use a schedule to define when an image should be send. Create a new schedule with the following settings.
157
-
158
-
-**Type**: `Pulse`
159
-
-**Name**: `Every minute`
160
-
-**Repeat every**: `1 Minute`
161
-
162
-
Click the *Save* button.
163
-
164
-
Now let's navigate to the *Rules* tab. Here we'll finally create a rule that combines the recipient and the schedule into a rule. Create a new rule with the following settings.
165
-
166
-
-**Name**: `Images to AWS S3`
167
-
-**Condition**: `Pulse`
168
-
-**Pulse**: `Every Minute`
169
-
-**Action**: `Send images through HTTPS`
170
-
-**Recipient**: `AWS S3`
171
-
-**Maximum images**: `1`
172
-
-**Custom CGI parameters**: Back when we deployed the AWS resources using CloudFormation stacks we talked about output parameters. The output parameter `AccessToken` points to a secret in AWS Secrets Manager. Follow the link, retrieve the secret value and format it according to `accessToken=<secret value>`. E.g. if the secret value is `FooBar` then the value you should enter here is `accessToken=FooBar`. Please note that copying the secret from AWS Secrets Manager sometimes adds a space in the beginning of the secret. Please make sure to remove this space before saving the rule.
173
-
174
-
Click the *Save* button.
175
-
176
-
At this point the rule will become active and send an image to AWS S3 every minute.
177
-
178
-
## Cleanup
179
-
180
-
To delete the deployed AWS resources, delete the CloudFormation stack either via the AWS Console or via the AWS CLI using the following command.
This section will highlight some of the common problems one might encounter when running this example application.
189
-
190
-
### No images are sent to AWS S3
191
-
192
-
If the camera is unable to successfully send images to AWS S3, please make sure that the following statements are true.
193
-
194
-
-**The camera is not behind a proxy**. This example does not support a network topology where requests needs to traverse a proxy to reach the internet.
0 commit comments