setting-up-ec2-instance-profiles

โดย aws

กำหนดค่า EC2 instances เพื่อเรียกใช้ AWS services อย่างปลอดภัยโดยการสร้างและแนบ IAM roles ผ่าน instance profiles ซึ่งช่วยขจัดความจำเป็นในการใช้ credentials แบบ hardcoded ใช้เมื่อ…

npx skills add https://github.com/aws/agent-toolkit-for-aws --skill setting-up-ec2-instance-profiles

Setting Up EC2 Instance Profiles

Overview

Domain expertise for granting EC2 instances secure access to AWS services using IAM roles and instance profiles. Covers the full lifecycle: identifying required permissions, creating or reusing IAM roles with least-privilege policies, creating instance profiles, attaching them to EC2 instances, and verifying credential availability.

Configure an EC2 instance profile

To set up an IAM role and instance profile for an EC2 instance, follow the procedure exactly. See EC2 instance profile setup procedure.

Troubleshooting

Instance not found

Verify the instance ID and region are correct. List instances with aws ec2 describe-instances --region <region>.

Instance already has a profile

The procedure handles replacement — it will prompt before disassociating the existing profile.

Credentials not available after attachment

Instance profile propagation can take 30–60 seconds. Applications may need a restart to pick up new credentials.

Access denied errors

Check that the role's policies include the required actions and resource ARNs. Review CloudTrail logs for the specific denied action.

Application still uses hardcoded credentials

Remove credentials from config files, environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), and ~/.aws/credentials. The SDK default credential chain will then use the instance profile.

Skills เพิ่มเติมจาก aws

analyzing-release-readiness
aws
เรียกใช้การตรวจสอบความพร้อมก่อนการรวมโค้ด (pre-merge release readiness review) บน GitHub PR, GitLab MR หรือสาขาในเครื่อง (local branch) ใช้เมื่อผู้ใช้ต้องการวิเคราะห์การเปลี่ยนแปลงโค้ดเพื่อหาความเสี่ยง ความถูกต้อง…
scanning-with-aws-security-agent
aws
รันการสแกน AWS Security Agent บนเวิร์กสเปซ — อัปโหลดซอร์สไปยัง AWS สแกนด้วยบริการ Security Agent ที่มีการจัดการ และส่งคืนผลลัพธ์ที่จัดอันดับและตรวจสอบแล้ว…
coordinating-multi-space-devops-agent
aws
ประสานงาน AWS DevOps Agent ในหลาย AgentSpaces จากเซสชัน Claude Code เดียว — กำหนดเส้นทางคำถามไปยังพื้นที่ที่ถูกต้อง (prod vs staging vs knowledge),…
aws-security
aws
ครอบคลุมบริการและเวิร์กโฟลว์ด้านความปลอดภัยของ AWS — Security Hub V2 (OCSF) findings, connectors, aggregators, automation rules และสรุปสถานะความปลอดภัย;…
querying-aws-sagemaker-catalog
aws
รันการวิเคราะห์ SQL บนตารางเมตาดาต้าของสินทรัพย์ SageMaker Catalog ที่ส่งออกเป็น Apache Iceberg ใน S3 Tables ครอบคลุมการสอบถามด้านธรรมาภิบาล การติดตามการเติบโตของสินทรัพย์…
agents-connect
aws
ใช้เมื่อเชื่อมต่อเอเจนต์ของคุณกับ API เครื่องมือ หรือบริการภายนอกผ่าน Gateway หรือจำกัดการเข้าถึงเครื่องมือด้วยนโยบาย Cedar จัดการการตั้งค่า Gateway เป้าหมาย…
aurora-dsql
aws
จัดเตรียมและจัดการคลัสเตอร์ Aurora DSQL เชื่อมต่อผ่าน psql หรือ DSQL Connectors จัดการสคีมา รันคิวรี ย้ายข้อมูลจาก MySQL วินิจฉัยแผนคิวรี…
transitgateway
aws
กำหนดค่า AWS Transit Gateway: สร้างฮับและเชื่อมต่อ VPC แบ่งกลุ่มทราฟฟิกด้วยตารางเส้นทาง รวมศูนย์อีเกรสและการตรวจสอบผ่านฮับ…