官术网_书友最值得收藏!

  • AWS Tools for PowerShell 6
  • Ramesh Waghmare
  • 253字
  • 2021-07-15 17:09:23

Managing AWS credentials

There are several ways to supply the AWS credentials. You can specify credential per-command, per-session, or for all the sessions. You should avoid exposing credentials in the command line in the form of literals, or supplying them each time you run the AWS cmdlet. For any cmdlet, there are some common parameters that you can supply each time you run the AWS-specific cmdlet. Those are mostly Access Key, Secret Access Key, Region, ProfileName, ProfileLocation , and so on. Exposing your AWS credentials in the cmdlet is not considered as a best practice. Instead, create a profile for each set of credentials that you want to use, and store the profile in the credential store. Specify the correct profile by name in your command, and let PowerShell retrieve the associated credentials from the store. You can create the different profiles using Set-AWSCredentials:

PS C:\> Set-AWSCredentials -AccessKey {xx} -SecretKey {xx} -StoreAs {MyProfileName}

If you are interested to know the other options, then refer to the online documentation. I would restrict credential management using profiles to avoid confusion in this book. If you created the profile using the Set-AWSCredentials cmdlet and want to make it a default profile for the session, then you can simply use the ProfileName parameter with the Set-AWSCredentials cmdlet:

PS C:\> Set-AWSCredentials -ProfileName {MyProfileName}

You can also specify ProfileName with the other cmdlet. For example, if you do not have any default profile set, then you can supply a profile to the AWS-related cmdlet:

PS C:\> Get-S3Bucket -ProfileName {MyProfileName}
主站蜘蛛池模板: 睢宁县| 桐城市| 莱西市| 雷州市| 红桥区| 赫章县| 林芝县| 建昌县| 响水县| 个旧市| 岫岩| 科技| 瓮安县| 营山县| 郴州市| 西贡区| 九江县| 孝感市| 喀什市| 鄯善县| 游戏| 富平县| 临海市| 随州市| 民和| 三河市| 墨脱县| 庆云县| 滁州市| 花莲县| 安仁县| 包头市| 桃源县| 和政县| 镶黄旗| 阿巴嘎旗| 邹平县| 綦江县| 丹凤县| 洛隆县| 温泉县|