Skip to content

Commit e5e7cce

Browse files
committed
Custom Metrics
1 parent 7a3b7d9 commit e5e7cce

File tree

2 files changed

+303
-0
lines changed

2 files changed

+303
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Publishing Custom Metrics from Lambda
2+
3+
Install the demo app using the [AWS Serverless Application Model](https://aws.amazon.com/serverless/sam/)
4+
5+
## Create the Lambda deployment package
6+
7+
`cd shopping-cart-app`
8+
9+
Create an S3 bucket in the location where you want to save the packaged code. If you want to use an existing S3 bucket, skip this step.
10+
11+
```sh
12+
aws s3 mb s3://123456789012-shopping-cart-app
13+
```
14+
15+
Create the deployment artifacts with dependencies
16+
17+
```sh
18+
sam build
19+
```
20+
21+
Create the Lambda function deployment package by running the following `package` AWS SAM CLI command at the command prompt.
22+
23+
```sh
24+
sam package \
25+
--output-template-file packaged.yaml \
26+
--s3-bucket 123456789012-shopping-cart-app
27+
```
28+
29+
In the AWS SAM CLI, use the `deploy` command to deploy all of the resources that you defined in the template.
30+
31+
```sh
32+
sam deploy \
33+
--template-file packaged.yaml \
34+
--stack-name shopping-cart-app \
35+
--capabilities CAPABILITY_IAM
36+
```
37+
38+
## Locate API Gateway Endpoint URLs
39+
40+
1. Open the AWS CloudFormation console at [https://console\.aws\.amazon\.com/cloudformation](https://console.aws.amazon.com/cloudformation/)\.
41+
1. Choose the AWS CloudFormation stack that you created in the preceding step from the list shown\.
42+
1. Under **Outputs**, note the API Gateway endpoint URLs.
43+
1. Browse each and observe the JSON responses.
44+
45+
## Generate Traffic
46+
47+
Using the API Gateway endpoint URLs in the previous step, generate load against each of these endpoints.
48+
49+
Modify `URLs.txt` to use the endpoint URLs in your account.
50+
51+
Run [Apache Bench](http://httpd.apache.org/docs/2.4/programs/ab.html) using [parallel](http://www.gnu.org/software/parallel/):
52+
53+
```sh
54+
cat URLs.txt | parallel 'ab -c 350 -n 20000 {}'
55+
```
56+
57+
## View Custom Metrics
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
.aws-sam
2+
packaged.yaml
3+
4+
# Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
5+
6+
### Linux ###
7+
*~
8+
9+
# temporary files which can be created if a process still has a handle open of a deleted file
10+
.fuse_hidden*
11+
12+
# KDE directory preferences
13+
.directory
14+
15+
# Linux trash folder which might appear on any partition or disk
16+
.Trash-*
17+
18+
# .nfs files are created when an open file is removed but is still being accessed
19+
.nfs*
20+
21+
### OSX ###
22+
*.DS_Store
23+
.AppleDouble
24+
.LSOverride
25+
26+
# Icon must end with two \r
27+
Icon
28+
29+
# Thumbnails
30+
._*
31+
32+
# Files that might appear in the root of a volume
33+
.DocumentRevisions-V100
34+
.fseventsd
35+
.Spotlight-V100
36+
.TemporaryItems
37+
.Trashes
38+
.VolumeIcon.icns
39+
.com.apple.timemachine.donotpresent
40+
41+
# Directories potentially created on remote AFP share
42+
.AppleDB
43+
.AppleDesktop
44+
Network Trash Folder
45+
Temporary Items
46+
.apdisk
47+
48+
### PyCharm ###
49+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
50+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
51+
52+
# User-specific stuff:
53+
.idea/**/workspace.xml
54+
.idea/**/tasks.xml
55+
.idea/dictionaries
56+
57+
# Sensitive or high-churn files:
58+
.idea/**/dataSources/
59+
.idea/**/dataSources.ids
60+
.idea/**/dataSources.xml
61+
.idea/**/dataSources.local.xml
62+
.idea/**/sqlDataSources.xml
63+
.idea/**/dynamic.xml
64+
.idea/**/uiDesigner.xml
65+
66+
# Gradle:
67+
.idea/**/gradle.xml
68+
.idea/**/libraries
69+
70+
# CMake
71+
cmake-build-debug/
72+
73+
# Mongo Explorer plugin:
74+
.idea/**/mongoSettings.xml
75+
76+
## File-based project format:
77+
*.iws
78+
79+
## Plugin-specific files:
80+
81+
# IntelliJ
82+
/out/
83+
84+
# mpeltonen/sbt-idea plugin
85+
.idea_modules/
86+
87+
# JIRA plugin
88+
atlassian-ide-plugin.xml
89+
90+
# Cursive Clojure plugin
91+
.idea/replstate.xml
92+
93+
# Ruby plugin and RubyMine
94+
/.rakeTasks
95+
96+
# Crashlytics plugin (for Android Studio and IntelliJ)
97+
com_crashlytics_export_strings.xml
98+
crashlytics.properties
99+
crashlytics-build.properties
100+
fabric.properties
101+
102+
### PyCharm Patch ###
103+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
104+
105+
# *.iml
106+
# modules.xml
107+
# .idea/misc.xml
108+
# *.ipr
109+
110+
# Sonarlint plugin
111+
.idea/sonarlint
112+
113+
### Python ###
114+
# Byte-compiled / optimized / DLL files
115+
__pycache__/
116+
*.py[cod]
117+
*$py.class
118+
119+
# C extensions
120+
*.so
121+
122+
# Distribution / packaging
123+
.Python
124+
build/
125+
develop-eggs/
126+
dist/
127+
downloads/
128+
eggs/
129+
.eggs/
130+
lib/
131+
lib64/
132+
parts/
133+
sdist/
134+
var/
135+
wheels/
136+
*.egg-info/
137+
.installed.cfg
138+
*.egg
139+
140+
# PyInstaller
141+
# Usually these files are written by a python script from a template
142+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
143+
*.manifest
144+
*.spec
145+
146+
# Installer logs
147+
pip-log.txt
148+
pip-delete-this-directory.txt
149+
150+
# Unit test / coverage reports
151+
htmlcov/
152+
.tox/
153+
.coverage
154+
.coverage.*
155+
.cache
156+
.pytest_cache/
157+
nosetests.xml
158+
coverage.xml
159+
*.cover
160+
.hypothesis/
161+
162+
# Translations
163+
*.mo
164+
*.pot
165+
166+
# Flask stuff:
167+
instance/
168+
.webassets-cache
169+
170+
# Scrapy stuff:
171+
.scrapy
172+
173+
# Sphinx documentation
174+
docs/_build/
175+
176+
# PyBuilder
177+
target/
178+
179+
# Jupyter Notebook
180+
.ipynb_checkpoints
181+
182+
# pyenv
183+
.python-version
184+
185+
# celery beat schedule file
186+
celerybeat-schedule.*
187+
188+
# SageMath parsed files
189+
*.sage.py
190+
191+
# Environments
192+
.env
193+
.venv
194+
env/
195+
venv/
196+
ENV/
197+
env.bak/
198+
venv.bak/
199+
200+
# Spyder project settings
201+
.spyderproject
202+
.spyproject
203+
204+
# Rope project settings
205+
.ropeproject
206+
207+
# mkdocs documentation
208+
/site
209+
210+
# mypy
211+
.mypy_cache/
212+
213+
### VisualStudioCode ###
214+
.vscode/*
215+
!.vscode/settings.json
216+
!.vscode/tasks.json
217+
!.vscode/launch.json
218+
!.vscode/extensions.json
219+
.history
220+
221+
### Windows ###
222+
# Windows thumbnail cache files
223+
Thumbs.db
224+
ehthumbs.db
225+
ehthumbs_vista.db
226+
227+
# Folder config file
228+
Desktop.ini
229+
230+
# Recycle Bin used on file shares
231+
$RECYCLE.BIN/
232+
233+
# Windows Installer files
234+
*.cab
235+
*.msi
236+
*.msm
237+
*.msp
238+
239+
# Windows shortcuts
240+
*.lnk
241+
242+
# Build folder
243+
244+
*/build/*
245+
246+
# End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode

0 commit comments

Comments
 (0)