aws_lambda_ric 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf1124bbf50d67d952fa22fcd35345899f5f8051e4c3d2be9ba87f0cc701cabb
4
- data.tar.gz: e32410af6693b00bb5ed60e6f7c1ff99d7dec53d4484982c18c338920ed401ce
3
+ metadata.gz: b33180932d42b43cbe38aaf19aca5a30c01212a209cec6eb577b62e8139f4d36
4
+ data.tar.gz: 64b49034a0cd70a4e974c8bb2c56c8e73cc607b36e66de08622f8daa3fba982f
5
5
  SHA512:
6
- metadata.gz: '005869f4ece8cdd2a5c93e771d377c8d4107121f0916259ecdf62bd57d5e4bc695dabad4f7695d70155c22bce0d5f13ec0be9db396f7dad86c8d364595d4d81c'
7
- data.tar.gz: fa08b30481f6ead00ab458515b8f4eef8ce8c4190432f879408329031383bb190cde4dcc7bd8691709d1220c98d80ff98d7561d984822b075f040ee2fb74982d
6
+ metadata.gz: 0dd4f76dabca24fcae696e0780be387eee6bdff75d1bf9b7f95f1d9e5a37a10823bb9f24b521bb9d64e55bf718b36a5a7f9c84625b7bb25fd4cf88eedaf89498
7
+ data.tar.gz: 6a95a1763b7263a87201ac82153cb27344e96927a582e3bae95003f29e3dbf1f60089d5791526624cd863d2b17983cdf03c9074a39b8cb85617f082bd796d550
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aws_lambda_ric (1.0.0)
4
+ aws_lambda_ric (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  minitest (5.14.2)
10
- rake (10.5.0)
10
+ rake (13.0.1)
11
11
 
12
12
  PLATFORMS
13
13
  ruby
@@ -16,7 +16,7 @@ DEPENDENCIES
16
16
  aws_lambda_ric!
17
17
  bundler (>= 2.0)
18
18
  minitest (~> 5.0)
19
- rake (~> 10.0)
19
+ rake (~> 13.0)
20
20
 
21
21
  BUNDLED WITH
22
22
  2.2.0.rc.2
data/README.md CHANGED
@@ -39,12 +39,10 @@ Or install it manually as:
39
39
 
40
40
 
41
41
  Next step would be to copy your Lambda function code into the image's working directory.
42
- ```Docker
43
- # Create function directory
42
+ ```dockerfile
43
+ # Copy function code
44
44
  RUN mkdir -p ${FUNCTION_DIR}
45
-
46
- # Copy handler function
47
- COPY app.rb ${FUNCTION_DIR}/app.rb
45
+ COPY app.rb ${FUNCTION_DIR}
48
46
 
49
47
  WORKDIR ${FUNCTION_DIR}
50
48
  ```
@@ -52,7 +50,7 @@ WORKDIR ${FUNCTION_DIR}
52
50
  The next step would be to set the `ENTRYPOINT` property of the Docker image to invoke the Runtime Interface Client and then set the `CMD` argument to specify the desired handler.
53
51
 
54
52
  Example Dockerfile:
55
- ```Docker
53
+ ```dockerfile
56
54
  FROM amazonlinux:latest
57
55
 
58
56
  # Define custom function directory
@@ -61,28 +59,28 @@ ARG FUNCTION_DIR="/function"
61
59
  # Install ruby
62
60
  RUN amazon-linux-extras install -y ruby2.6
63
61
 
62
+ # Install bundler
63
+ RUN gem install bundler
64
+
64
65
  # Install the Runtime Interface Client
65
66
  RUN gem install aws_lambda_ric
66
67
 
67
- # Create function directory
68
+ # Copy function code
68
69
  RUN mkdir -p ${FUNCTION_DIR}
69
-
70
- # Copy handler function
71
- COPY app.rb ${FUNCTION_DIR}/app.rb
70
+ COPY app.rb ${FUNCTION_DIR}
72
71
 
73
72
  WORKDIR ${FUNCTION_DIR}
74
73
 
75
- ENTRYPOINT ["aws_lambda_ric"]
74
+ ENTRYPOINT ["/usr/local/bin/aws_lambda_ric"]
76
75
  CMD ["app.App::Handler.process"]
77
76
  ```
78
77
 
79
78
  Example Ruby handler `app.rb`:
80
- ```rb
79
+ ```ruby
81
80
  module App
82
81
  class Handler
83
82
  def self.process(event:, context:)
84
- message = "Hello World!"
85
- { statusCode: 200, body: { 'message': message } }
83
+ "Hello World!"
86
84
  end
87
85
  end
88
86
  end
@@ -90,8 +88,58 @@ end
90
88
 
91
89
  ### Local Testing
92
90
 
93
- For testing locally you will need to set up a local Runtime Interface Emulator against which the Runtime Interface Client will make API calls. You will need to post data to the endpoint it creates in order to invoke your function. For more information check out the [Runtime Interface Emulator](https://github.com/aws/aws-lambda-runtime-interface-emulator).
91
+ To make it easy to locally test Lambda functions packaged as container images we open-sourced a lightweight web-server, Lambda Runtime Interface Emulator (RIE), which allows your function packaged as a container image to accept HTTP requests. You can install the [AWS Lambda Runtime Interface Emulator](https://github.com/aws/aws-lambda-runtime-interface-emulator) on your local machine to test your function. Then when you run the image function, you set the entrypoint to be the emulator.
92
+
93
+ *To install the emulator and test your Lambda function*
94
+
95
+ 1) From your project directory, run the following command to download the RIE from GitHub and install it on your local machine.
94
96
 
97
+ ```shell script
98
+ mkdir -p ~/.aws-lambda-rie && \
99
+ curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
100
+ chmod +x ~/.aws-lambda-rie/aws-lambda-rie
101
+ ```
102
+ 2) Run your Lambda image function using the docker run command.
103
+
104
+ ```shell script
105
+ docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
106
+ --entrypoint /aws-lambda/aws-lambda-rie \
107
+ myfunction:latest \
108
+ /usr/local/bin/aws_lambda_ric app.App::Handler.process
109
+ ```
110
+
111
+ This runs the image as a container and starts up an endpoint locally at `http://localhost:9000/2015-03-31/functions/function/invocations`.
112
+
113
+ 3) Post an event to the following endpoint using a curl command:
114
+
115
+ ```shell script
116
+ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'.
117
+ ```
118
+
119
+ This command invokes the function running in the container image and returns a response.
120
+
121
+ *Alternately, you can also include RIE as a part of your base image. See the AWS documentation on how to [Build RIE into your base image](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-alternative).*
122
+
123
+ ## Development
124
+
125
+ ### Building the package
126
+ Clone this repository and run:
127
+
128
+ ```shell script
129
+ make init
130
+ make build
131
+ ```
132
+
133
+ ### Running tests
134
+
135
+ Make sure the project is built:
136
+ ```shell script
137
+ make init build
138
+ ```
139
+ Then,
140
+ * to run unit tests: `make test`
141
+ * to run integration tests: `make test-integ`
142
+ * to run smoke tests: `make test-smoke`
95
143
 
96
144
  ## Security
97
145
 
@@ -99,4 +147,5 @@ If you discover a potential security issue in this project we ask that you notif
99
147
 
100
148
  ## License
101
149
 
102
- This project is licensed under the Apache-2.0 License.
150
+ This project is licensed under the Apache-2.0 License.
151
+
@@ -7,16 +7,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
7
  require './lib/aws_lambda_ric/version'
8
8
 
9
9
  Gem::Specification.new do |spec|
10
- spec.name = 'aws_lambda_ric'
11
- spec.version = AwsLambdaRuntimeInterfaceClient::VERSION
12
- spec.authors = ['AWS Lambda']
10
+ spec.name = 'aws_lambda_ric'
11
+ spec.version = AwsLambdaRuntimeInterfaceClient::VERSION
12
+ spec.authors = ['AWS Lambda']
13
13
 
14
- spec.summary = 'AWS Lambda Runtime Interface Client for Ruby'
15
- spec.description = 'The AWS Lambda Ruby Runtime Interface Client implements the Lambda programming model for Ruby.'
16
- spec.homepage = 'https://github.com/aws/aws-lambda-ruby-runtime-interface-client'
14
+ spec.summary = 'AWS Lambda Runtime Interface Client for Ruby'
15
+ spec.description = 'The AWS Lambda Ruby Runtime Interface Client implements the Lambda programming model for Ruby.'
16
+ spec.homepage = 'https://github.com/aws/aws-lambda-ruby-runtime-interface-client'
17
+
18
+ spec.license = 'Apache-2.0'
19
+ spec.required_ruby_version = '>= 2.5'
17
20
 
18
21
  # Specify which files should be added to the gem when it is released.
19
- spec.files = %w[
22
+ spec.files = %w[
20
23
  LICENSE
21
24
  README.md
22
25
  Gemfile
@@ -26,12 +29,12 @@ Gem::Specification.new do |spec|
26
29
  bin/aws_lambda_ric
27
30
  ] + Dir['lib/**/*']
28
31
 
29
- spec.bindir = 'bin'
32
+ spec.bindir = 'bin'
30
33
  # all application-style files are expected to be found in bindir
31
- spec.executables = 'aws_lambda_ric'
32
- spec.require_paths = ['lib']
34
+ spec.executables = 'aws_lambda_ric'
35
+ spec.require_paths = ['lib']
33
36
 
34
37
  spec.add_development_dependency 'bundler', '>= 2.0'
35
38
  spec.add_development_dependency 'minitest', '~> 5.0'
36
- spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
37
40
  end
@@ -3,5 +3,5 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  module AwsLambdaRuntimeInterfaceClient
6
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_lambda_ric
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AWS Lambda
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  description: The AWS Lambda Ruby Runtime Interface Client implements the Lambda programming
56
56
  model for Ruby.
57
57
  email:
@@ -80,7 +80,8 @@ files:
80
80
  - lib/aws_lambda_ric/version.rb
81
81
  - lib/aws_lambda_ric/xray_cause.rb
82
82
  homepage: https://github.com/aws/aws-lambda-ruby-runtime-interface-client
83
- licenses: []
83
+ licenses:
84
+ - Apache-2.0
84
85
  metadata: {}
85
86
  post_install_message:
86
87
  rdoc_options: []
@@ -90,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
91
  requirements:
91
92
  - - ">="
92
93
  - !ruby/object:Gem::Version
93
- version: '0'
94
+ version: '2.5'
94
95
  required_rubygems_version: !ruby/object:Gem::Requirement
95
96
  requirements:
96
97
  - - ">="