question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ec2-instance-connect client does not use session profile credentials

See original GitHub issue

Describe the bug The ec2-instance-connect client uses the default aws profile, not the one specified in the session

Steps to reproduce

b3session = boto3.Session(profile_name='stage')
s3client = b3session.client('s3')
    for bucket in s3client.list_buckets():
        print(bucket.name) //Will list the stage profile

client = b3session.client('ec2-instance-connect', region_name=instance['region'])
client.send_ssh_public_key( //Will use "default profile"
    InstanceId=instance['instanceId'],
    SSHPublicKey=key,
    AvailabilityZone=instance['az'],
    InstanceOSUser=myuser
)

Expected behavior I am expecting ec2-instance-connect client to use the session profile

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stilrencommented, Apr 8, 2021

Hello @stobrien89! After some intense troubleshooting I found out that the error was me not specifying the correct profile when I then tried to connect to the instance (using aws ssm). This one is on me. Thanks for the attention.

0reactions
stobrien89commented, Apr 8, 2021

Hi @stilren,

Of course—Glad you were able to get it working. Let us know if anything else comes up!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up EC2 Instance Connect - Amazon Elastic Compute Cloud
You can check for an SSH client by typing ssh at the command line. If your local computer doesn't recognize the command, you...
Read more >
AWS SSO Support does not work #17 - GitHub
I currently have SSO credentials using the command aws sso login, which work fine for aws cli (v2) commands, but mssh does not...
Read more >
STS — Boto3 Docs 1.26.33 documentation - AWS
Returns a set of temporary security credentials that you can use to access Amazon Web Services resources that you might not normally have...
Read more >
Never put AWS temporary credentials in the ... - Ben Kehoe
We need to talk about how AWS credential configuration works. Many people have more than one IAM principal that they use on a...
Read more >
Remote Access to EC2 instances, the easy (and secure) way
But there are downsides: ✗ An SSH port on a public IP address will get scanned and credential-stuffed on a near-continuous basis. Your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found