-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/dist | ||
/vendor | ||
/ec2meta | ||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
### Go template | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
binary: ec2meta | ||
ldflags: | ||
- -s -w -X github.com/invit/ec2meta/internal/lib/version.Version={{.Version}} -X github.com/invit/ec2meta/internal/lib/version.Commit={{.Commit}} -X github.com/invit/ec2meta/internal/lib/version.Date={{.Date}} | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
archives: | ||
- files: | ||
- LICENSE | ||
- README.md | ||
checksum: | ||
name_template: 'checksums.txt' | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Invit Travel GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.PHONY: build install snapshot dist test vet lint fmt run clean | ||
OUT := ec2meta | ||
PKG := github.com/invit/ec2meta | ||
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/) | ||
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/) | ||
|
||
all: build | ||
|
||
build: | ||
CGO_ENABLED=0 GOOS=linux go build -a -o ${OUT} ${PKG} | ||
|
||
install: | ||
CGO_ENABLED=0 GOOS=linux go install -a -v ${PKG} | ||
|
||
snapshot: | ||
goreleaser --snapshot --rm-dist | ||
|
||
dist: | ||
goreleaser --rm-dist | ||
|
||
test: | ||
@go test -v ${PKG_LIST} | ||
|
||
vet: | ||
@go vet ${PKG_LIST} | ||
|
||
lint: | ||
@for file in ${GO_FILES} ; do \ | ||
golint $$file ; \ | ||
done | ||
|
||
fmt: | ||
@gofmt -l -w -s ${GO_FILES} | ||
|
||
clean: | ||
-@rm -vf ${OUT} | ||
-@rm -vrf dist | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# ec2meta | ||
|
||
Simple CLI to query AWS EC2 instance metadata. | ||
|
||
## Usage | ||
|
||
``` | ||
$ ec2meta | ||
Display EC2 instance meta data | ||
Usage: | ||
ec2meta [command] | ||
Available Commands: | ||
get Returns arbitrary meta data by path | ||
help Help about any command | ||
version Print the version number of ec2meta | ||
Flags: | ||
-h, --help help for ec2meta | ||
Use "ec2meta [command] --help" for more information about a command. | ||
``` | ||
|
||
### Query | ||
|
||
``` | ||
$ ec2meta help get | ||
Returns arbitrary meta data by path | ||
Usage: | ||
ec2meta get <path> [flags] | ||
Flags: | ||
-h, --help help for get | ||
``` | ||
|
||
`<path>` can be either point to a directory path like | ||
|
||
``` | ||
$ ec2meta get / | ||
ami-id | ||
ami-launch-index | ||
ami-manifest-path | ||
block-device-mapping/ | ||
events/ | ||
hibernation/ | ||
hostname | ||
iam/ | ||
identity-credentials/ | ||
instance-action | ||
instance-id | ||
instance-life-cycle | ||
instance-type | ||
local-hostname | ||
local-ipv4 | ||
mac | ||
metrics/ | ||
network/ | ||
placement/ | ||
profile | ||
public-hostname | ||
public-ipv4 | ||
reservation-id | ||
security-groups | ||
services/ | ||
``` | ||
|
||
a single element | ||
|
||
``` | ||
$ ec2meta get /hostname | ||
ip-10-0-0-248.eu-central-1.compute.internal | ||
``` | ||
|
||
or access either all `[*]` or a specific element in a list: | ||
|
||
``` | ||
$ ec2meta get /network/interfaces/macs/[0]/vpc-id | ||
vpc-XXXXXXXX | ||
``` |