jtblin / aws-mock-metadata Goto Github PK
View Code? Open in Web Editor NEWMock ec2 instance metadata service that can run on a developer machine
License: Other
Mock ec2 instance metadata service that can run on a developer machine
License: Other
AWS recently added new fields, most notably region
:
region, placement group name, partition number, host ID, and availability zone-ID:
I could create a PR.
placement/group-name
placement/host-id
placement/partition-number
placement/region
placement/availability-zone-id
Sample values:
placement/region: us-west-2
placement/availability-zone-id: usw2-az1
A use case for this is scripts that access ECR which has AWS account ids in the repository URL.
I can submit a PR.
Implemented in a fork:
Hi I'd really like to run an EC2 metadata mock/spoof server in docker to test an EC2 library I have using compose. I've tried the docker run -it ...
command you provided as well as building with go
but to no avail. Is there any chance you could provide a more detailed example using either compose or just docker to run this?
I think it make sense to make this as a package, so we can use it as a mock for unit testing in kube2iam. What do you think?
Hey @jtblin do you mind adding auto builds on Docker Hub? Thanks
Sometimes it is nice to be able to mock that an instance has been set for spot termination. This is indicated by the spot/termination-time
key existing
How would I go about debugging:
time="2018-10-14T07:33:42Z" level=info msg="Requesting /latest/meta-data/instance-id"
time="2018-10-14T07:33:42Z" level=info msg="Requesting /latest/meta-data/iam/info"
time="2018-10-14T07:33:42Z" level=error msg="Not found info"
running in minikube with:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: aws-mock
labels:
app: aws-mock
spec:
selector:
matchLabels:
app: aws-mock
template:
metadata:
name: aws-mock
labels:
app: aws-mock
spec:
containers:
- image: jtblin/aws-mock-metadata
imagePullPolicy: Always
name: aws-mock
ports:
- containerPort: 80
protocol: TCP
env:
- name: AVAILABILITY_ZONE
value: "us-west-2"
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-creds
key: AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-creds
key: AWS_SECRET_ACCESS_KEY
- name: AWS_SESSION_TOKEN
valueFrom:
secretKeyRef:
name: aws-creds
key: AWS_SESSION_TOKEN
- name: AWS_SDK_LOAD_CONFIG
value: "1"
args:
- "--availability-zone=us-west-2"
- "--instance-id=i-0a148cec064fc841c"
- "--app-port=80"
- "--private-ip=172.28.159.34"
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
Can't see a good way to force using Version 1 in things like awscli
right now, would be nice to have some minimum viable functionality for Version 2 in here to cover that off. From what I can tell, probably just the .../api/token
namespace, plus the use of PUT
?
Hi, thanks for sharing this project :)
When I run curl --dump-header 169.254.169.254
on "actual" EC2 instances, I get:
$ curl --dump-header - http://169.254.169.254
HTTP/1.0 200 OK
Content-Type: text/plain
Accept-Ranges: bytes
ETag: "83579665"
Last-Modified: Thu, 19 May 2016 08:21:00 GMT
Content-Length: 153
Connection: close
Date: Fri, 27 May 2016 06:36:38 GMT
Server: EC2ws
*snip*
which includes the Server: EC2ws
header.
Running the same curl command against aws-mock-metadata doesn't return it.
It may be a problem when you tried to use aws-mock-metadata
to test applications that expect metadata service to return that header.
An example of such application is fluentd-plugin-google-cloud
which relies on it to determine where it is running on(EC2 or GCE).
I would like to use/fork/contribute to this project but it is currently unlicensed, which in most countries means that the license is a default "all rights reserved" copyright (preventing anyone from using your code).
Please see github documentation/recommendations and choose a license:
https://help.github.com/articles/open-source-licensing/
http://choosealicense.com/
My personal favorites these days are the MIT (same as the python implementation that inspired this project) or Modified BSD licenses.
Hey @jtblin
I currently have a fork at https://github.com/CpuID/aws-mock-metadata with about 80~% test coverage over the entire EC2 Metadata API (including redirects, endpoint listings, etc), which is close to all passing but still needs some minor work.
Would you be interested in adding me as a maintainer to the project? Happy to PR my changes back here in the process also. Or would you prefer me to maintain an independent fork?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.