Comments (5)
Can you clarify what all you changed in the daemonset file? It looks like you just added an args block to specify the -c /var/mock/aemm-config.json
?
Also, you mentioned you downloaded the v1.0.0 bundle but the config looks like you're using the v0.9.4 bundle.
Regarding the application error, can you clarify how you setup the aemm-config
configMap?
from amazon-ec2-metadata-mock.
-
Regarding daemonset file:
Yes, I just added args block. -
Regarding bundle (at the issue):
It's a copy & paste issue. I'm using the bundle v0.9.4. By the way, I compared both (v1.0.0 vs v0.9.4) and looks pretty the same, except their bundle versions. I fixed the issue to address proper file. -
Regarding the configMap file:
apiVersion: v1
data:
aemm-config.json: |
{
"config-file": "$HOME/aemm-config.json",
"events": {
"code": "system-reboot",
"not-after": "2020-06-18T13:35:03-05:00",
"not-before": "2020-06-11T13:35:03-05:00",
"not-before-deadline": "2020-06-20T13:35:03-05:00",
"state": "active"
},
"imdsv2": false,
"metadata": {
"paths": {
"ami-id": "/latest/meta-data/ami-id",
"ami-launch-index": "/latest/meta-data/ami-launch-index",
"ami-manifest-path": "/latest/meta-data/ami-manifest-path",
"block-device-mapping-ami": "/latest/meta-data/block-device-mapping/ami",
"block-device-mapping-ebs": "/latest/meta-data/block-device-mapping/ebs0",
"block-device-mapping-ephemeral": "/latest/meta-data/block-device-mapping/ephemeral0",
"block-device-mapping-root": "/latest/meta-data/block-device-mapping/root",
"block-device-mapping-swap": "/latest/meta-data/block-device-mapping/swap",
"elastic-inference-accelerator": "/latest/meta-data/elastic-inference/associations/eia-bfa21c7904f64a82a21b9f4540169ce1",
"elastic-inference-associations": "/latest/meta-data/elastic-inference/associations",
"events": "/latest/meta-data/events/maintenance/scheduled",
"hostname": "/latest/meta-data/hostname",
"iam-info": "/latest/meta-data/iam/info",
"iam-security-credentials": "/latest/meta-data/iam/security-credentials/baskinc-role",
"iam-security-credentials-role": "/latest/meta-data/iam/security-credentials",
"instance-action": "/latest/meta-data/instance-action",
"instance-id": "/latest/meta-data/instance-id",
"instance-type": "/latest/meta-data/instance-type",
"local-hostname": "/latest/meta-data/local-hostname",
"local-ipv4": "/latest/meta-data/local-ipv4",
"mac": "/latest/meta-data/mac",
"mac-device-number": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/device-number",
"mac-ipv4-associations": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/ipv4-associations/192.0.2.54",
"mac-ipv6-associations": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/ipv6s",
"mac-local-hostname": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/local-hostname",
"mac-local-ipv4s": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/local-ipv4s",
"mac-mac": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/mac",
"mac-network-interface-id": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/interface-id",
"mac-owner-id": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/owner-id",
"mac-public-hostname": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/public-hostname",
"mac-public-ipv4s": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/public-ipv4s",
"mac-security-group-ids": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/security-group-ids",
"mac-security-groups": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/security-groups",
"mac-subnet-id": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-id",
"mac-subnet-ipv4-cidr-block": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-ipv4-cidr-block",
"mac-subnet-ipv6-cidr-blocks": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-ipv6-cidr-blocks",
"mac-vpc-id": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-id",
"mac-vpc-ipv4-cidr-block": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv4-cidr-block",
"mac-vpc-ipv4-cidr-blocks": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv4-cidr-blocks",
"mac-vpc-ipv6-cidr-blocks": "/latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv6-cidr-blocks",
"placement-availability-zone": "/latest/meta-data/placement/availability-zone",
"product-codes": "/latest/meta-data/product-codes",
"public-hostname": "/latest/meta-data/public-hostname",
"public-ipv4": "/latest/meta-data/public-ipv4",
"public-key": "/latest/meta-data/public-keys/0/openssh-key",
"reservation-id": "/latest/meta-data/reservation-id",
"security-groups": "/latest/meta-data/security-groups",
"services-domain": "/latest/meta-data/services/domain",
"services-partition": "/latest/meta-data/services/partition",
"spot": "/latest/meta-data/spot/instance-action",
"spot-termination-time": "/latest/meta-data/spot/termination-time"
},
"values": {
"ami-id": "ami-0a887e401f7654935",
"ami-launch-index": "0",
"ami-manifest-path": "(unknown)",
"block-device-mapping-ami": "/dev/xvda",
"block-device-mapping-ebs": "sdb",
"block-device-mapping-ephemeral": "sdb",
"block-device-mapping-root": "/dev/xvda",
"block-device-mapping-swap": "sdcs",
"elastic-inference-accelerator": {
"version_2018_04_12": {
"elastic-inference-accelerator-id": "eia-bfa21c7904f64a82a21b9f4540169ce1",
"elastic-inference-accelerator-type": "eia1.medium"
}
},
"elastic-inference-associations": "eia-bfa21c7904f64a82a21b9f4540169ce1",
"event-id": "instance-event-1234567890abcdef0",
"hostname": "IP-172-16-34-43.EC2.INTERNAL",
"iam-info": {
"code": "Success",
"instanceprofilearn": "arn:aws:iam::896453262835:instance-profile/baskinc-role",
"instanceprofileid": "AIPA5BOGHHXZELSK34VU4",
"lastupdated": "2020-04-02T18:50:40Z"
},
"iam-security-credentials": {
"accesskeyid": "12345678901",
"code": "Success",
"expiration": "2020-04-02T00:49:51Z",
"lastupdated": "2020-04-02T18:50:40Z",
"secretaccesskey": "v/12345678901",
"token": "TEST92test48TEST+y6RpoTEST92test48TEST/8oWVAiBqTEsT5Ky7ty2tEStxC1T==",
"type": "AWS-HMAC"
},
"iam-security-credentials-role": "baskinc-role",
"instance-action": "none",
"instance-id": "i-1234567890abcdef0",
"instance-type": "m4.xlarge",
"local-hostname": "ip-172-16-34-43.ec2.internal",
"local-ipv4": "172.16.34.43",
"mac": "0e:49:61:0f:c3:11",
"mac-device-number": "0",
"mac-ipv4-associations": "192.0.2.54",
"mac-ipv6-associations": "2001:db8:8:4::2",
"mac-local-hostname": "ip-172-16-34-43.ec2.internal",
"mac-local-ipv4s": "172.16.34.43",
"mac-mac": "0e:49:61:0f:c3:11",
"mac-network-interface-id": "eni-0f95d3625f5c521cc",
"mac-owner-id": "515336597381",
"mac-public-hostname": "ec2-192-0-2-54.compute-1.amazonaws.com",
"mac-public-ipv4s": "192.0.2.54",
"mac-security-group-ids": "sg-0b07f8f6cb485d4df",
"mac-security-groups": "ura-launch-wizard-harry-1",
"mac-subnet-id": "subnet-0ac62554",
"mac-subnet-ipv4-cidr-block": "192.0.2.0/24",
"mac-subnet-ipv6-cidr-blocks": "2001:db8::/32",
"mac-vpc-id": "vpc-d295a6a7",
"mac-vpc-ipv4-cidr-block": "192.0.2.0/24",
"mac-vpc-ipv4-cidr-blocks": "192.0.2.0/24",
"mac-vpc-ipv6-cidr-blocks": "2001:db8::/32",
"placement-availability-zone": "us-east-1a",
"product-codes": "3iplms73etrdhxdepv72l6ywj",
"public-hostname": "ec2-192-0-2-54.compute-1.amazonaws.com",
"public-ipv4": "192.0.2.54",
"public-key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/JxGByvHDHgQAU+0nRFWdvMPi22OgNUn9ansrI8QN1ZJGxD1ML8DRnJ3Q3zFKqqjGucfNWW0xpVib+ttkIBp8G9P/EOcX9C3FF63O3SnnIUHJsp5faRAZsTJPx0G5HUbvhBvnAcCtSqQgmr02c1l582vAWx48pOmeXXMkl9qe9V/s7K3utmeZkRLo9DqnbsDlg5GWxLC/rWKYaZR66CnMEyZ7yBy3v3abKaGGRovLkHNAgWjSSgmUTI1nT5/S2OLxxuDnsC7+BiABLPaqlIE70SzcWZ0swx68Bo2AY9T9ymGqeAM/1T4yRtg0sPB98TpT7WrY5A3iia2UVtLO/xcTt test",
"reservation-id": "r-046cb3eca3e201d2f",
"security-groups": "ura-launch-wizard-harry-1",
"services-domain": "amazonaws.com",
"services-partition": "aws"
}
},
"mock-delay-sec": 0,
"save-config-to-file": true,
"server": {
"hostname": "0.0.0.0",
"port": "1338"
},
"spot": {
"action": "terminate",
"time": ""
}
}
kind: ConfigMap
metadata:
creationTimestamp: "2020-06-18T17:27:53Z"
name: aemm-config
namespace: default
resourceVersion: "507745"
selfLink: /api/v1/namespaces/default/configmaps/aemm-config
uid: ca0f1d11-b0e5-4683-9de8-3bc444a89e58
Worth to say that running the command (amazon/amazon-ec2-metadata-mock:v0.9.4
) locally through docker and using the file embedded into the configmap, the application run successfully.
Evidence:
docker run -v `pwd`:/var/mocks -it --rm amazon/amazon-ec2-metadata-mock:v0.9.4 -c /var/mocks/aemm-config.json
The output:
Using configuration from file: /var/mocks/aemm-config.json
Successfully saved final configuration to local file //.ec2-metadata-mock/.aemm-config-used.json
2020/06/19 12:21:24 Initiating ec2-metadata-mock for all mocks on port 1338
Flags:
config-file: /var/mocks/aemm-config.json
2020/06/19 12:21:24 Serving the following routes: /latest/meta-data/spot/termination-time, /latest/meta-data/iam/info, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/security-groups, /latest/meta-data/public-hostname, /latest/meta-data/block-device-mapping/ebs0, /latest/meta-data/elastic-inference/associations, /latest/meta-data/public-ipv4, /latest/meta-data/services/domain, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/ipv6s, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-ipv6-cidr-blocks, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv4-cidr-block, /latest/meta-data/events/maintenance/scheduled, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/public-hostname, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-id, /latest/meta-data/services/partition, /latest/meta-data/ami-id, /latest/meta-data/ami-launch-index, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv6-cidr-blocks, /latest/api/token, /latest/meta-data/block-device-mapping/root, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/device-number, /latest/meta-data/ami-manifest-path, /latest/meta-data/hostname, /latest/meta-data/instance-action, /latest/meta-data/instance-type, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/interface-id, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-id, /latest/meta-data/instance-id, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/ipv4-associations/192.0.2.54, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/subnet-ipv4-cidr-block, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/vpc-ipv4-cidr-blocks, /latest/meta-data/reservation-id, /latest/meta-data/block-device-mapping/ami, /latest/meta-data/block-device-mapping/swap, /latest/meta-data/local-hostname, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/mac, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/public-ipv4s, /latest/meta-data/placement/availability-zone, /latest/meta-data/public-keys/0/openssh-key, /latest/meta-data/, /latest/meta-data/mac, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/owner-id, /latest/meta-data/product-codes, /, /latest/meta-data/local-ipv4, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/local-hostname, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/security-group-ids, /latest/meta-data/network/interfaces/macs/0e:49:61:0f:c3:11/local-ipv4s, /latest/meta-data/security-groups, /latest/meta-data, /latest/meta-data/block-device-mapping/ephemeral0, /latest/meta-data/elastic-inference/associations/eia-bfa21c7904f64a82a21b9f4540169ce1, /latest/meta-data/spot/instance-action, /latest/meta-data/iam/security-credentials, /latest/meta-data/iam/security-credentials/baskinc-role
from amazon-ec2-metadata-mock.
Thanks for the detailed information! We will investigate and post back soon
from amazon-ec2-metadata-mock.
The problem is the way you're specifying args:
args:
- -c /var/mocks/aemm-config.json
The above is equivalent to passing the arg and value in as one os arg like this:
$ ec2-metadata-mock "-c /var/mocks/aemm-config.json"
You can pass the args in like this:
args: ["-c", "/var/mocks/aemm-config.json"]
from amazon-ec2-metadata-mock.
Closing as it seems like the issue has been resolved. Feel free to reopen if needed.
from amazon-ec2-metadata-mock.
Related Issues (20)
- standard_init_linux.go:228: exec user process caused: exec format error HOT 3
- Deploy Helm Chart HOT 3
- Add `tags/instance` path HOT 2
- Emulate specifying `PUT` response hop limit HOT 1
- /latest/user-data ? HOT 2
- Conform the real IMDS by not listing dirs
- Dump all metadata to a file HOT 3
- Userdata formatting HOT 1
- Userdata in getHandlerPairs()? HOT 1
- marketplaceProductCodes field is typed as a string instead of a list of strings HOT 1
- Please document how to serve real credentials in the mocked data HOT 11
- Passing null value in AEMM config parameter HOT 6
- Optionally support the removal of instances tags within returned metadata HOT 2
- [bug] cannot add a new tag using config overrides HOT 3
- Provide this mock as a Java library HOT 2
- [feature request] Watch config file for changes and reload HOT 2
- Programmatic use in Go tests HOT 2
- Incorrect Content-Type response header HOT 4
- IAM credentials should have realistic values HOT 2
- Missing EC2ws header HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-ec2-metadata-mock.